for each array javascript example
Example 1: how to use the foreach method in javascript
groceries.forEach(groceryItem => console.log(groceryItem));
Example 2: foreach javascript
Used to execute the same code on every element in an array
Does not change the array
Returns undefined