Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
d-fanelli72638dFucking made my shitty day! Redux is my satan 😂😂😂😂
I feel kinda bad for laughing ... but that is funny.
Someone here posted a list of array iterating and reasons for using the various .forEach() .map() .reduce() and so on. It was pretty handy as honestly I just think of them as loops and ... forget sometimes.
d-fanelli72638dI’m not a fan of reduce, map etc as replacements for for loops bc they make code hard to read to people who are unfamiliar with them. Most programmers are familiar with for loops, as they’re used in most languages out there
Lensflare203037d@N00bPancakes While forEach() is indeed a loop, it’s better to think of map() and reduce() as data transformations.
map() transforms a sequence of elements into a sequence of other elements.
reduce() transforms a sequence of elements into one element.
They can be implemented as loops but thinking in loops makes it only more complicated.
And also you can use transformations on streams which do not have a defined end or number of elements.
You can't do that with loops.
c3r38r170163237dLoved it. I'm in love with reduce.