Peformance issues with javascript map and reduce

broken image

It’s like the confusion with objects types - it’s wrong to conflate those two ideas as they are different things. The idea of map and reduce is that they operate generically over data, not as a property of objects that can use that about themselves. It really boils down to the fact that in JS you can call array.map() and it’s a property of the array - the array is not an array, a data primitive, but an object representing an array. Luckily, map does at least return a new array. Let’s set aside mutation in Javascript causing issues, because that’s a given. What is my issue with map and reduce in Javascript?

broken image