Can someone help me how to resolve this please?

Tell us what’s happening:

Your code so far


// Setup
var total = 0;
var myArr = [ 2, 3, 4, 5, 6];
for(i=0; i<=myArr.length; i++){
total += myArr[i];
}
// Only change code below this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Iterate Through an Array with a For Loop

Link to the challenge:

Don’t forget to declare your variables.

// Setup

var total = 0;

var i = 0;

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

for(i=0; i<=myArr.length; i++){

total += myArr[i];

}
like thiss? bc it does not work

@pabloalonnso29 you should only loop through the length of your array. If you start from i=0 then you need to stop at arr.length. Rethink your loop parameters again. It is only a simple fix :wink: