The arr.forEach() method call the provided function for each element of the array. The provided function may perform any kind of operation on the elements of the given array.
Parameters: This method accepts Four parameters as mentioned above and described below:
- array: the array on which the specified function is called.
- forEach: the method called for the array with the required parameters.
- function(element, index, arr): the function with its parameters which is required to run for each element of the array.
- element: the value of the current element.
- index: the index of the current element being processed.
- arr: the array object on which function was called.
- thisValue: value to be used as the function’s this value when executing it. “undefined” is passed if this value is not provided.
I hope it can help you...