how to foreach through an array code example
Example 1: javascript foreach example
var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
console.log(color);
});
Example 2: how to use the foreach fnction javascript loop through array
const names = ['Anthony','Stacey','Mason','Gracie','Koda','Nani'];
forEach(function(name) {
console.log(name);
});