.forEach() and .map() in javascript

These functions is similar array method that excute callback function on every element in this array.
The difference is .map() return new array but .forEach() return array itself. It means .map() doesn’t affect provided array but .forEach() affect provided array.

Definition

The map() method creates a new array with the results of calling a provided function on every element in this array.

The forEach() method executes a provided function once per array element.