Nesting loops javascript

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**
function multiplyAll(arr) {
let product = 1;
// Only change code below this line
function multiplyAll(arr) {
let product = 1;
// Only change code below this line
for (let i = 0; i < arr.length; i++) {
  const subArray = arr[i];
  for (let j = 0; j < subArray.length; j++) {
    product *= subArray[j];
  }
}
// Only change code above this line
return product;
}
// Only change code above this line
return product;
}

multiplyAll([[1, 2], [3, 4], [5, 6, 7]]);

This is a really tough one.

How far off is this code?

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Nesting For Loops

Link to the challenge:

Not far, but keep in mind you only need a nested loop inside the function provided; in your code there are two functions with the same name and two return calls.

Thank you.

That makes perfect sense.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.