Basic JavaScript: Nesting For Loops Help

Tell us what’s happening:
I just need someone to explain how this code iterates through each number in the arr list array. I do not understand the logic. This is just the provided example from the curriculum and I don’t even get that.

Your code so far

var arr = [
  [1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
  for (var j=0; j < arr[i].length; j++) {
    console.log(arr[i][j]);
  }
}

Your browser information:

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

Challenge: Nesting For Loops

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops

To understand this code, you need to learn about arrays and how they work.

Then ask yourself, “How would an array of arrays work?”.

Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr

ure functions is adding is that what u want?
or do u want to multiply?

I understand how arrays work and how items in them are targeted.

Does the variable j get reset to 0 once the loop passes back to the first for loop? That is the only way I can see it working if it is console.log 1 2 3 4 5 6
[0][0]
[0][1]
[1][0]
[1][1]
[2][0]
[2][1]

everything inside the loop is executed once for each iteration
if inside the loop there is an other loop, that means that the inner loop will start from its starting value at each iteration (as the variable is initialised at that value each time)