Basic JavaScript - Nesting For Loops

Tell us what’s happening:
Describe your issue in detail here.
i’m not sure what is going on ! I also am not sure i understand how this multiply every sub array by 1.

  **Your code so far**
function multiplyAll(arr) {
let product = 1;
// Only change code below this line
for (let i = 0; i < arr.lenght; i++) {
for(let j = 0; j < arr[i].length; j++) {
  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 (X11; CrOS x86_64 14816.131.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Nesting For Loops

Link to the challenge:

There is an issue with this statement. Can you spot it?

1 Like

omg, I feel so stupid I looked at at three times thinking that had to be it. I keep spelling it wrong tonight, even though I know how to spell it. It finally hit me when I realized they didn’t match. Although I can’t find things when they are right in frnt of my face. That was the first thing I thought when I saw ur msg and still missed it lol!!!

That is something one needs to be very careful when you work with JavaScript - you can never know where and what the mistake is, especially with large programs. Programming languages like Java, for example, do not compile with such misspells!

This is when debug statements (like the console.log) placed strategically in your code can help note unsuspecting issues.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.