foreach item (function) code example Example: how to use the foreach method in javascript groceries.forEach(groceryItem => console.log(groceryItem));