Mr. Wiryo carries the accumulator along the train one wagon a step, and the platform’s chalk board keeps each value it held: a total, a maximum, a count, a…
The key idea
reduce rolls an array into one value
Try it in this playground
Follow the total step by step Run (acc, n) => acc + n to the end and watch the board note every acc.
Run it with no start value The first call moves to wagon 1; try an empty train [] too.
Forget the return (acc, n) => { acc + n } makes acc undefined after the first wagon.
Count with an object Use the tally with the start value {}: acc is one object that keeps filling up.