I'm really not that great with Javascript (in fact, I'm actually pretty bad/basic), but I think I know what it does. (Confident in this post, yet?

)
Right.
I'll just break down the entire line of code.
So first the author is defining the function 'addUp'. A practical name, to be sure. I hope you understand what I mean when I say that the 'input' for the function is the variable numArray (which seems to be an array that he/she's already defined.
In the function, the author wants the following to occur:
1. The browser to define the variable total for a value of 0.
2. To run the for loop such that:
a. variable i is defined for 0 (the first number in the array - tricky, isn't it?)
b. that it continue while i is less than the length of the numArray array (which, in this case, is 4).
c. if it is less, then the browser should add 1 to i after it's done.
3. Every time the for loop runs, the following should happen:
a. the variable total (right now, it's 0) should be added to the current value in the array. If you want to think of it in a different way, think of it as, "Add the value of the array 'numArray' to the existing total".
4. Finally, after the for loop completes, the function addUp will return the variable 'total'
The author then defines the Total as the returned value (the variable 'total') of the function addUp for values 1, 5, 3, and 9 of the array numArray.
Hope I helped.
~TehYoyo
Bookmarks