How does the parameter "index" pull an index from an array

Consider this array and function:

let names = ["Greg", "Mike", "Tom"];

names.forEach(function(item, index){
       console.log(index, item)//will print out index in array, and item in that index.
});

Sorry, but it doesn’t make much sense to me how this works. Could someone explain?

it is just how the to forEach method works. the 1st argument is the element nd the 2nd argument is the index
You can name them what ever you want, but values are what they are. It let’s you access the element and index to use in the function.