DEV Community

Discussion on: JavaScript array methods: Mutator VS Non-mutator and the returning value

Collapse
 
fetishlace profile image
fetishlace

Nice overview. But yes, I would not say .forEach() mutates too, since it is just kind of loop function - passed function may or may not mutate array on which it runs, it could be used for some side effects, it could be used to modify totally different array/object - it is just a loop over items in array and it does not imply any kind of function / computation in that loop.