3 ms·
I don't quite get the author's beef, even from the screenshot he has a couple down. I personally love reduce. Reduce is probably my favorite function an iterab
by rubyn00bie 7y ago
I don't quite get the author's beef, even from the screenshot he has a couple down.
I personally love reduce. Reduce is probably my favorite function an iterable, or enumerable, can have... Is it really that clever to map and then reduce something?
You can totally use reduce when you shouldn't or when it makes your life more difficult, but you can also eat fried chicken and drink hot coffee driving naked down the freeway during rush-hour.... it's up to you to make smart choices.
- codedokode 7y agoIt is much more clever just to use a for .. in loop and write the actions sequentially rather than as a set of anonymous functions. Writing software should not be a competition about who knows more new features.
- deleted 7y ago[deleted]
- sdegutis 7y agoReduce shouldn't be considered in the same category as nullish-coalescing. Reduce is on par with array.map. It's perfect for when you have an iterable and want to reduce it down, pair by pair, to one item. It should be used when that situation comes up, and it shouldn't be used outside of it. This is pretty cut and dried.
- postalrat 7y agoIs Array.map worth keeping?