window.onload=function(){
var arr = [[1,2,4],[5,6,7],[8,9,10]];
var i =3,j=3;
var result1=0,result2=0;
for(var m=0;m<i;m++){
for(var n=0;n<j;n++){
if(m==n){
result1+=arr[m][n];
}
if(m+n==i-1){
result2+=arr[m][n];
}
}
}
alert([result1,result2])
}