Help me understand: Nesting for Loops

Tell us what’s happening:
What is arr[i]
and why does it need to be there yes i get that it is an array but, what does it do?
if we leave it out
we still get the numbers like
but then we get an undefined
why is that? and why do we need the lenght of it? when we already have the lenght of

function multiplyAll(arr) 

Your code so far

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


Your browser information:

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

Challenge: Nesting For Loops

Link to the challenge:

you need to access the numbers, so you need to use arr[i] to get the inner arrays, but then you need to access the numbers inside those arrays, so to get that it is arr[i][x]

with the following you are not certainly getting the correct result.

1 Like