01 / 05
Gathering everything into one
To sum every element in an array, up to now we put let total = 0; outside a loop and added items one by one.
"Summing everything up" and "folding into a single result" are very common operations. The tool to do this in a single line is reduce.