Nesting For Loops: TypeError: Can't read property 'length' of undefined

Hi all! I’ve been staring at this one for a while and can’t figure out why I’m getting this error. It looks like it’s interpreting arr as an object.

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Can anyone see what’s wrong here? I feel like the logic should be working.

Thanks

Updated: Found the problem. :slight_smile: Thanks anyway!

Change your "i"s to "j"s in your second for loop and I think you got it.

edit: oops, just saw your update! Glad you figured out the solution.

what did you do ?
it’s still undefind…