Iterate Through an Array with a For Loop - Why 20?

Iterate Through an Array with a For Loop - Why 20?
0

#1

Exercise URL https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop

I actually passed the lesson but I would like to know what makes the solution 20? I am trying to really understand what I typed. I’ve been printing to console to see if I got the correct solution prior to submitting my code.

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
var myTotal = 0;

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

#2

2+3+4+5+6 = 20


#3

Ahh okay yes I get it. Thanks!