Nesting for loops please help

Tell us what’s happening:
Describe your issue in detail here.
what am I doing wrong

  **Your code so far**

function multiplyAll(arr) {
var product = 1;
for (var i=0; i < arr.length; i++) {
  for (var j=0; j < arr[i].length; j++) {
    product *= arr[i][j];
  }
  
}
// Only change code below this line

// Only change code above this line
return product;

}

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


console.log(product);
  **Your browser information:**

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

Challenge: Nesting For Loops

Link to the challenge:

HI again!

You should be seeing this in your console.
Screen Shot 2021-07-25 at 2.35.17 PM

It is not defined because of where you placed your console.log
Product is defined in the function, not outside.

Either comment out that console.log or move it just before the return statement to pass the test.

1 Like

thanks you such a great help :grinning: :grinning: :grinning:

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