MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/btxz72/what_are_some_javascript_things_beginners_dont/ep4tq02
r/javascript • u/[deleted] • May 28 '19
383 comments sorted by
View all comments
19
Reduce. A many to one relationship is way more verbose to manage without it.
4 u/ThatSpookySJW May 28 '19 Also all those nifty higher order functions like map, sort, and filter 0 u/[deleted] May 29 '19 [deleted] 1 u/zephyrtr May 29 '19 Well at least they filtered before they mapped, but yes that grinds my gears. Especially since it's so easy to rewrite: if (filterFunc(item)) accumulator.push(mapFunc(item)); return accumulator;
4
Also all those nifty higher order functions like map, sort, and filter
0
[deleted]
1 u/zephyrtr May 29 '19 Well at least they filtered before they mapped, but yes that grinds my gears. Especially since it's so easy to rewrite: if (filterFunc(item)) accumulator.push(mapFunc(item)); return accumulator;
1
Well at least they filtered before they mapped, but yes that grinds my gears. Especially since it's so easy to rewrite: if (filterFunc(item)) accumulator.push(mapFunc(item)); return accumulator;
if (filterFunc(item)) accumulator.push(mapFunc(item)); return accumulator;
19
u/zephyrtr May 28 '19
Reduce. A many to one relationship is way more verbose to manage without it.