Skip to content

Comment on You Can't JavaScript Under Pressureparent

Comments

Anytime where you are trying to "collect" features of an array into one final value, and the collection function can be sensibly applied to the elements in any order as long as some interim value is passed along (e.g. summing, maximizing), the reduce paradigm is appropriate and can be more readable.

The bonus upside is that these paradigms also make parallelism quite simple, should it later be necessary.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.