Scroll Down
For this quick usage consider that var awesomeArray = [1, 2, 3, 4, 5];.awesomeArray.forEach(function(element, index) { });
Javascript’s ES5 forEach() Array method is a fast way to iterate through all elements of an array. It executes the provided function for each element of the array, passing down the current element and index.
var awesomeArray = [1, 2, 3, 4, 5];
var thisValue = window;
awesomeArray.forEach(function(element, index, array) {
/* do something */
}, thisValue);
Function passing the current element, current index and the full arrayas paramenters.
The context on which the function is running. Defaults to undefined.
This method returns undefined.
All browsers.