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.
map
andforEach
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 offorEach
, it will manipulate the array directly. That's the difference.Thanks. Got it now)