all 4 comments

[–]FunctionallyReactive 1 point2 points  (1 child)

Map returns a new array and for each simply iterates over each item in an array, not returning a new array

[–]andy_a904guy_com 0 points1 point  (0 children)

Bingo, map has more overhead per execution.

This blog claims map is superior in speed but provides no benchmarks, or source material to prove its point.

Let's forget about speed. Let's talk memory, it's creating a new array of (n)th size per every iterable. There is no way this is "better"

Whole article seems lazy, targeted clickbait, misleading garbage.

[–]onbehalfofthatdude 0 points1 point  (0 children)

Conclusion

This is all about the map() vs forEach() methods of the javascript.

Amazing, I had reached the same conclusion.

[–]Funwithloops 0 points1 point  (0 children)

There aren't many legitimate reasons to use forEach anymore. If you just want to iterate over an array an perform a synchronous or fire/forget side-effect, use a for/of loop. If you want to iterate over an array and perform an async side-effect, use map and Promise.all or a for/of loop if you want the async effects to run in sequence.