👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
How to use the forEach() method in JavaScript?

The JavaScript ForEach() function runs a provided function for each array element. Here is an example:

var myArray = ['one', 'two', 'three'];

myArray.forEach( function (item, index) {
	console.log(index, item);
})

// Expected output in the console : 
// 0 "one"
// 1 "two"
// 2 "three"
The forEach() method can also be used with arrow function:

var myArray = ['one', 'two', 'three'];
myArray.forEach( item => console.log(item));

More