var arr = [This outputs each sub-element in
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
arr
one at a time. Note that for the inner loop, we are checking the .length
of arr[i]
, since arr[i]
is itself an array.
multiplyAll
so that it multiplies the product
variable by each number in the sub-arrays of arr
multiplyAll([[1],[2],[3]])
should return 6
'
testString: 'assert(multiplyAll([[1],[2],[3]]) === 6, ''multiplyAll([[1],[2],[3]])
should return 6
'');'
- text: 'multiplyAll([[1,2],[3,4],[5,6,7]])
should return 5040
'
testString: 'assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, ''multiplyAll([[1,2],[3,4],[5,6,7]])
should return 5040
'');'
- text: 'multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
should return 54
'
testString: 'assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, ''multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
should return 54
'');'
```