4 ms·
I have mixed feelings about "Reduce". It is hard to use and, most of the time, hard to read as well. It's too low-level. Fair enough. I'd certainly always pref
by buu700 7y ago
I have mixed feelings about "Reduce". It is hard to use and, most of the time, hard to read as well. It's too low-level.
Fair enough. I'd certainly always prefer a special case like `.sum()` over something like `.reduce((a, b) => a + b, 0)` where applicable.
I don't think reduce is overly complicated, but it's not much of a step up over a for loop and can be abused to write code that's more confusing to reason about than an equivalent loop.