Tell us what’s happening:
Describe your issue in detail here.
Can someone please describe how the math is done in this exercise? How is product * arr[i][j] calculated. I’m confused on everything in the arrays are mulitplied together. Your code so far

function multiplyAll(arr) {
let 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;
}
multiplyAll([[1, 2], [3, 4], [5, 6, 7]]);

Your browser information:

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

So is the function multiplying the indexes of i and j or the values inside of the array? So like 0*0 because of the index or is it 1 * 2 * 1 because the 0 index of i is [1, 2] and the 0 index of j is 1.

You’ve initialized product to 1 before we begin the loops, so we know that the first time we get to that line, it is really going to be:

product = 1 * arr[i][j];

And since it is the first time through both the outer and inner for loop, arr[i][j] is really arr[0][0] which is 1. So the very first time we hit that line it is really:

product = 1 * 1;

So product still equals 1 after the first time through the inner loop.

But there are two elements in the first sub array, so while i is 0, j will first be 0 (as described above) and then the second time through the inner loop it will be 1:

product = product * arr[0][1];

We know that product is 1 at this point, so we can rewrite it as:

product = 1 * arr[0][1];

So what is the value of arr[0][1]? Based on that, what will the value of product be after the inner for loop is completed while i is 0?

Since arr[i] is the outer array do we use the index value to find the product? So like say [i] is 1, so the [3, 4] index and say that [j] is on the fourth index which is 5. Would it be

If i is 1 then arr[i] is [3, 4]. Since there are only two numbers in that array then j can only be either 0 or 1.

product = 1 * 1 * 5

This is never a possibility. The code is:

product = product * arr[i][j];

So there can only ever be two numbers on the right of the equals sign. The value of product will be whatever it currently is, and the value of arr[i][j] is the value retrieved from the array at those indices.

I think I understand now. So the first loop of [i] finds the values of [1, 2], [j] multiplies 1 and 2 and gives i [0] a value of 2. Next loop is the 3,4 which is 12, next is 5,6,7 which is 210. Then those values are multiplied together to get 5040.

I’m not quite sure you got it. The value of the items in the array never change. The only value that changes is product as you multiply it with new numbers.

Perhaps I did not read your explanation correctly? It would really help if you used correct syntax in your explanation.

And as @JeremyLT shows below, sometimes you just have to console log it out to see what’s going on