I wanted to know the exact answer and there were huge list of answers.
Many were totally incorrect.
So I opted second way to find difference. I went to MDN and downloaded polyfill for forEach and map function.
It turns out there is only one difference in forEach and map function.
So, forEach is subset for map function.
I never use forEach function in my code. I always use map function.
Even of you do not want to use Array returned by map function, you need not to worry as It will be collected back !
Post a Comment