Iterate Through an Array with a For Loop help needed

Tell us what’s happening:

Hey FCC, got a bit stuck on this lesson today, couldn’t figure out what i was doing wrong. Any help is greatly appreciated.

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];
var total = 0;
// Only change code below this line
for (var a = 0; i < myArr.length; a++) {
  total += myArr[a];

Your browser information:

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

Link to the challenge:

I think you must declare the variable total below the line which says // Only change code below this line. :wink:

You have a wild i there, while you are using a as the variable for the loop

Oh, that’s right. I must have overlooked it. :+1:

Oof, that makes me look real dumb. Thanks for the answer man

Totally normal