Hello!
I am busy with the Legacy JavaScript course. I done what the instruction asked me to, but don’t know where I went wrong. I checked on the Get a Hint
as well, and I found the solution, and I didn’t find anything wrong with my code. Maybe my eyes are deceiving me or something. Ive added the solution to my code as well. Please assist.
function multiplyAll(arr) {
let product = 1;
// Only change code below this line
for (var i = 0; i < arr.lenght; i++) {
for (var j = 0; j < arr[i].lenght; j++) {
product *= arr[i][j];
}
}
// Solution below
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < arr[i].length; j++) {
product = product * arr[i][j];
}
}
// Solution above
// Only change code above this line
return product;
}
multiplyAll([[1, 2], [3, 4], [5, 6, 7]]);
Challenge Information:
Basic JavaScript - Nesting For Loops