Iterate Through an Array with a For Loop - problem

Hi, I’m having trouble with this exercise. My code is like that:

var myArr = [ 2, 3, 4, 5, 6];
var myTotal = 0;

for (var i = 0; i < myArr.length; i++) {
myTotal += myArr[i];
}

Is still returning the error that total should equal 20 and declared and initialized to 0.

Any help?

You should

Declare and initialize a variable total

not myTotal

Nothing wrong, but the challenge wants you to use total instead of myTotal

yeah, that was the whole problem lol, thanks