Why does fruits change to fruit?

Why does the identifier change? I am able to pass this issue with the code below. Why is “fruit” accepted even though it isn’t’ declared? It seems like, with this and the examples, plurals are made into singulars in this situation. That doesn’t make sense to me, though.

fruits.forEach(fruit => console.log("I want to eat a " + fruit))

Yes, but it is declared as the formal parameter of the function.

const callback = function (fruit) {
    console.log(`I want to eat a ${fruit}.`);
1 Like

Thanks for the reply! I’m happy to say that it clicked for me not long after I posted. I’ve been so used to the standard function writing format, that fat arrow is still resonating with me. “fruit” is the parameter which “fruits” is passed through as an argument, and using .forEach makes the individual strings of the array pass one at a time.


When we don’t need this in our function, arrow syntax is nice and brief…

const callback = fruit => {
    console.log(`I want to eat a ${fruit}.`);