Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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. -
I’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
-
@d-fanelli don't see how, if they don't know the function they are either junior needing the knowledge or senior which are outdated so it is time to learn it, if they know them, it is basically telling them why you are iterating over the array.
-
@d-fanelli people who are unfamiliar with that should learn and adapt. Not the other way around. You should not sacrifice clarity of intent for devs who are unexperienced or unwilling to learn.
-
@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.
Related Rants
😂😂😂😂😂
joke/meme
funny