Hacker News new | ask | show | jobs
by danfritz 60 days ago
I can only say: learn how to use reduce and you never loop twice through a list of items or objects.

To me reduce is very easy to reason about and makes it super easy to properly filter, combine, extract values without ending with filters on filters on maps and maps

1 comments

Doing everything in one reduce step sounds to me like the opposite of "easy to reason about". Reduce is a powerful tool that everyone should know, but you don't always want to wield the most powerful tool, especially if you're after intermediate values like the OP is.