Open utterances-bot opened 3 years ago
it looks like you have mix up the map and forEach In fact it is map that does not mutates the original array and returns new one https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
@abashkin thanks for pointing that out, you are so right. I don't know what I was thinking while writing the article 😂
I've just pushed an update.
forEach() vs. map() — JavaScript Array Function Comparison
This article does a quick comparison of the two JavaScript functions. After reading this, you should know when to use which function and why.
https://felixgerschau.com/foreach-vs-map-javascript/?fbclid=IwAR2ujIiZnX52U7RfkgMKEhG35ys5fygGjvVPxGuBSZQt817RARzNi1GCGW0