In the below example from Codecademy, I don’t really understand how the console can process the ‘artist’ parameter in a higher-order function, considering that we’ve only declared ‘artists’ up to this point?
const artists = ['Picasso', 'Kahlo', 'Matisse', 'Utamaro'];
artists.forEach(artist => {
console.log(artist + ' is one of my favorite artists.');
});
How can we use ‘artist’ and not something like:
artist[i]
New contributor
Nick Saunders is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.