Iterate Through an Array with a For Loop. i cant figure out how to add the items in the array to my total

Tell us what’s happening:

Your code so far

// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) {
  ourTotal += ourArr[i];

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

// Only change code below this line
for(var total = 0; total <=myArr.length; total++){
  total +=myArr[total];

Your browser information:

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

Link to the challenge:

see the example, they have a total variable initialized at 0, and then a variable i inside the loop to iterate through each element inside the array. you can’t use the variable to which you are adding things as variable for the loop, you get unexpected results, like that your loop ends before you want it because it reaches myArr.length sooner than you want

You can see your code being executed here if you want to follow your code being executed:

Hello thanks very much…i guess i was just being too forward and not taking note of details…thanks and do have a nice day