javascript
-
Reduce Function Explained
The reduce function iterates through an array executing the provided callback function once for each item in the array. Resulting to a single output value. The callbackFn above receives four values (accumulator, current, index, sourceArray) but often you only need the first two (accumulator, current).