DEV Community

Discussion on: Map, Filter, & Reduce in JavaScript

Collapse
 
cappe987 profile image
Casper

Ideally, you shouldn't modify the original array at all. Funtional programming encourages immutability. From a strictly functional perspective you should really only use forEach() for IO operations, like changing the DOM.