DEV Community

Discussion on: JavaScript Reduce Method Made Simple

Collapse
 
tevdevelops profile image
Tevin Rivera • Edited

Great and to the point article. Thanks for the brush up. The examples had a great pace to them, but I did want to note that your example on how to find the min of an array (const numbers = [1,3,5,7,9,11]) says that it will return 6 instead of 1

And maybe that is a good thing because I was looking at it over and over until I had to open my console and double check that it should be 1. Haha felt like I was back in school again.

And also, maybe you should include a note about how If initialValue is specified, that also causes currentValue to be initialized to the first value in the array. If initialValue is not specified, previousValue is initialized to the first value in the array, and currentValue is initialized to the second value in the array.