--- title: Nesting For Loops --- # Nesting For Loops --- ## Problem Explanation #### Relevant Links --- ## Hints ### Hint 1 Make sure to check with length and not the overall array. ### Hint 2 Use both i and j when multiplying the product. ### Hint 3 Remember to use arr[i] when you multiply the sub-arrays with the product variable. --- ## Solutions
Solution 1 (Click to Show/Hide) ```javascript function multiplyAll(arr) { var product = 1; // Only change code below this line for (var i = 0; i < arr.length; i++) { for (var j = 0; j < arr[i].length; j++) { product = product * arr[i][j]; } } // Only change code above this line return product; } // Modify values below to test your code multiplyAll([[1, 2], [3, 4], [5, 6, 7]]); ``` #### Code Explanation