Created
September 3, 2015 01:11
-
-
Save bricejlin/9bec138d2ca71cf4cd19 to your computer and use it in GitHub Desktop.
multidimensional arr sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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