Javascript Reduce

Helper Function vs No Helper Function

The callback function will always receive an accumulator (acc) and an element of the array as the function iterates through. The accumulator is the number/object/array that is passed from one call of this callback function to the next.

Sum Up A Value in the Array

Using Reduce instead of Map

Creating a Dictionary

Looking for the Max Value

Conclusion

Bonus: Flattening an Array

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store