DEV Community

Discussion on: JAVASCRIPT IRL: Examples of JavaScript's reduce function in real life

Collapse
 
epresas profile image
epresas • Edited

Great post! Very clear and well detailed, one thing I noticed is that in the first example the reduce function is not targeting arrayOfPeople but arr.... And the curr value is referring to each object of the array so in order to work it has to be acc + curr.age. I know it was an example to illustrate the concept, but for the reader that never has worked with this it might be confusing...
Thanks for the effort to help this community grow, and keep up the good work!

Collapse
 
shaileshcodes profile image
Shailesh Vasandani

Thanks so much for catching that! I updated it in the article. I'm glad you enjoyed the post, and thanks for the support!