I'm following a coursera course and I'm a bit stuck on a line of code. I understand what it does but not why. The video explains how to get the avarage value of an Array.
I found this code online and its exactly the part that I don't get:
var numbers = [10, 20, 30, 40] // sums to 100
var sum = 0;
for (var i = 0; i < numbers.length; i++) {
sum += numbers[i]
}
I don't get this part:
sum+=numbers[i]
I read it as sum = 0+4.
What am I missing?