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
1
2
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;
}
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/81.0.4044.129 Safari/537.36
.
Challenge: Nesting For Loops
Link to the challenge: