DEV Community

Discussion on: 🎯 JS Interview Checklist - Part 1 (Basics)

Collapse
adityasharan01 profile image
Aditya Sharan

Could you elaborate on this : Map and forEach don't mutate the original array,
As the example suggests, forEach does the operations on the Existing array.

Collapse
rajatetc profile image
Rajat Gupta Author

Basically, the callback passed inside the forEach method is performing operations on the existing array and not forEach itself. forEach returns undefined. You can read more here: freecodecamp.org/news/4-main-diffe...