Skip to content

Instantly share code, notes, and snippets.

@bricejlin
Created September 3, 2015 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bricejlin/9bec138d2ca71cf4cd19 to your computer and use it in GitHub Desktop.
Save bricejlin/9bec138d2ca71cf4cd19 to your computer and use it in GitHub Desktop.
multidimensional arr sum
var multiArr = [[3,4],[4,1],[1,1]];
var sum = multiArr.map(function (arr) {
return arr.reduce(add, 0);
}).reduce(add, 0);
function add (a, b) {
return a + b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment