arr
中的每个子元素。提示,对于内部循环,我们可以通过arr[i]
的.length
来获得子数组的长度,因为arr[i]
的本身就是一个数组。
multiplyAll
,获得arr
内部数组的每个数字相乘的结果product
。
multiplyAll([[1],[2],[3]])
应该返回 6
。
testString: assert(multiplyAll([[1],[2],[3]]) === 6);
- text: multiplyAll([[1,2],[3,4],[5,6,7]])
应该返回 5040
。
testString: assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040);
- text: multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
应该返回 54
。
testString: assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54);
```