forEach basic
by ptums
HTML
<div id="first-foreach">
</div>
JavaScript
// my example array to execute the forEach method on
const myWebStack = ['JavaScript', 'HTML', 'CSS', 'somtimes PHP', 'sometimes Python', 'sometimes SaSS'];
// executing the forEach method on the array myWebStack
myWebStack.forEach(function(item, index, array) {
console.log(item);
});
// the return message is this...
/*
"JavaScript"
"HTML"
"CSS"
"somtimes PHP"
"sometimes Python"
"sometimes SaSS"
*/