Gotta disagree here. In my experience, especially over the last several years, array methods have been pushed super hard in the JS community.
Sure the amount of content about map, filter and reduce has increased over the years but that is something you learn later down the road. I would imagine that for and while loops are still the prefered way to teach beginners about iteration.
I rarely see a simple for loop (of any flavor) these days; it's always long chains of .map().filter().map().reduce().flatMap()...
To be fair map is actually quite useful.
that's the point that Jake makes in the video referenced in this article, and I find his examples pretty convincing: among all the array methods, reduce is by far the least readable, and it often requires time and mental gymnastics to figure out what a reduce function is doing,
I like that they show cases where reduce is completely unnecesary, but that doesn't make reduce bad it's just easier to misuse. In some cases the thing that hurt readability is the inline callback with clever code trying to do everything in one expression.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sure the amount of content about
map
,filter
andreduce
has increased over the years but that is something you learn later down the road. I would imagine thatfor
andwhile
loops are still the prefered way to teach beginners about iteration.To be fair
map
is actually quite useful.I like that they show cases where
reduce
is completely unnecesary, but that doesn't makereduce
bad it's just easier to misuse. In some cases the thing that hurt readability is the inline callback with clever code trying to do everything in one expression.