DEV Community

Discussion on: 15 must-know JavaScript array methods in 2020

Collapse
 
ibrahima92 profile image
Ibrahima Ndaw

map and forEach technically they do the same job. They both iterate your data holden in a given array. But under the hood they are different. map instead of manipulating the array directly, it will return a new array that contains an image of each element of the array. In the case of forEach, it will manipulate the array directly. That's the difference.

Collapse
 
vsment profile image
Vasyl

Thanks. Got it now)