Home / Javascript Tips Generated By ChatGPT / Understanding Array.forEach() for Iterating Arrays in Javascript Execute a function on each item in an array. Source Code ["apple", "banana", "cherry"].forEach(function(fruit, index) { console.log(index, fruit); });