javascript map vs foreach? - whats the difference
in short..
map returns a new array based on the callback
<>
foreach doesn't return but can change the original array
map can be chained with .filter and other chaining methods
<>
foreach doesn't
map is 3 times quicker
<>
foreach is slower
Top comments (0)