Let’s take a look at forEach.
Here is a bare bones implementation of the forEach method. Note that we did not include index as a parameter, though it can be refactored quite easily to include it. We use a forEach when we want a projection function to act upon each element in the array. However, note that forEach does not return an array. If you do not need to directly change the elements in the array, but still want a function to act upon each element in the array, then forEach would be a good choice.