.forEach() method

const groceries = [‘brown sugar’, ‘salt’, ‘cranberries’, ‘walnuts’];

groceries.forEach(function(groceryItem) {
console.log(’ - ’ + groceryItem);

Two questions on this example from Iterators, Module 2:

https://www.codecademy.com/courses/introduction-to-javascript/lessons/javascript-iterators/exercises/for-each

  1. Where is “groceryItem” defined?

  2. Why does the function print out the list without having declared “groceryItem” anywhere?

If you press ctrl f or whatever brings up your find/search/thing and type groceryItem, then you’ll find two mentions of them, so if one of them uses it, then surely the other defines it

You might want to look up what forEach does.