var arr = [Esto genera cada subelemento en
[1,2], [3,4], [5,6]
];
para (var i = 0; i <arr.length; i ++) {
para (var j = 0; j <arr [i] .length; j ++) {
console.log (arr [i] [j]);
}
}
arr
uno a la vez. Tenga en cuenta que para el bucle interno, estamos comprobando la .length
de arr[i]
, ya que arr[i]
es en sí misma una matriz. multiplyAll
para que multiplique la variable del product
por cada número en los subarreglos de arr
multiplyAll([[1],[2],[3]])
debe devolver 6
'
testString: 'assert(multiplyAll([[1],[2],[3]]) === 6, "multiplyAll([[1],[2],[3]])
should return 6
");'
- text: 'multiplyAll([[1,2],[3,4],[5,6,7]])
debe devolver 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]])
debe devolver 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
");'
```