Learn JavaScript
Advanced Array Methods
31.15
Lesson

forEach()

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.