Can't see what I did wrong!

Tell us what’s happening:
Please, help me to solve this problem! I rewrote the code several times but for some reason it didn’t work.

Your code so far


// Setup
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
var total = 0;
for (var i = 0; i < myArr.lenght; i++) {
total += myArr[i];
}
console.log(total);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15.

Challenge: Iterate Through an Array with a For Loop

Link to the challenge:

@yakimyuk15 spelled length wrong mate

1 Like

length is misspelled.

I’m so grateful for such a quick answer :kissing_closed_eyes:

1 Like

Thanks a lot) Can’t believe that the problem was here :joy: