2 ms·
That's the thing about functional programming. I personally don't remember the last time I had the need to write a foreach loop. Foreach loops even kind of feel
by bestest 9y ago
That's the thing about functional programming. I personally don't remember the last time I had the need to write a foreach loop. Foreach loops even kind of feel _dirty_ to me.
All I really need now is Array.map, Array.reduce, Array.filter, Array.sort, Object.keys, Object.values.
Reduce is very powerful, you just have to get to know it.
Edit: this is how I'd use reduce in this case — https://news.ycombinator.com/item?id=14919636 https://news.ycombinator.com/item?id=14919636 — talk about line numbers