258 Views
In the code above, array.reduce() takes a callback function. This callback sets the sum to an initial value of zero. Then it loops over every item in the array, In the first loop, it adds currentItem to the initial value, 0. It stores the sum in accumulator.
0 comments