Learn JavaScript
Advanced Array Methods


The forEach() method executes a function for each element of an array.

The function inside the forEach() method accepts three arguments.

As can be seen in the example given above, the arguments are element, which is the value of the element, index, which is the index of the element and array, which is the array on which the method operates.