Nesting For Loops- Not sure whats going on?

Tell us what’s happening:
The console keeps feeding me: “Typeerror: console read property ‘0’ of undefined”

Your code so far

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 *= arr.length[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]]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/nesting-for-loops

Look close at this
product *= arr.length[i][j];
Explain what it is doing.

1 Like

Its taking the value of the product and multiplying it by the indexed number (If it was written properly it would have)

Just noticed my error!! Thank you

1 Like

Not correct arr.length is used to get the length of the array to get the indexed number do it like
so lets say i=0 arr[i] = [1,2]
now lets say i=0 and j=0 arr[i][j] = 1