Nesting For Loops: Why do you have to check the [i] length?

I have a question about the Inner Loops lesson:

For the inner For Loop, I used

for (var j = 0; j < arr.length; j++)

In theory, shouldn’t this also work, since arr.length is 3? The solution tells me I need to use arr[i].length

The solution they gave was:

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

But arr[0] is [1,2] - so you need to iterate over only two numbers, and arr[0].length is 2

arr[0][2]is undefined, I think the multiplication with this would result in NaN (Not a Number), so you would not get the result you want

Oh that makes sense. I thought it would only multiply however long the array is. Thank you!!