1function sum_array(arr) {
2
3 // store our final answer
4 var sum = 0;
5
6 // loop through entire array
7 for (var i = 0; i < arr.length; i++) {
8
9 // loop through each inner array
10 for (var j = 0; j < arr[i].length; j++) {
11
12 // add this number to the current final sum
13 sum += arr[i][j];
14
15 }
16
17 }
18
19 return sum;
20
21}
22
23sum_array([[3, 2], [1], [4, 12]]);
24