Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VoloshchenkoAl/63282a7d1ec5b6609c6f to your computer and use it in GitHub Desktop.
Save VoloshchenkoAl/63282a7d1ec5b6609c6f to your computer and use it in GitHub Desktop.
var arr = [[3,1,1,1],
[1,1,1,1],
[1,1,1,1],
[1,1,1,1]];
var sum = arr.reduce(function(prev,cur,i){
return prev+cur[i]+cur[arr.length-1-i];
},0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment