Did I miss anything?

Am I missing something here? I completed this lesson with the code below:

const fruits = [‘mango’, ‘papaya’, ‘pineapple’, ‘apple’]; // simple array

// Iterate over fruits below
// arrow syntax

fruits.forEach(fruits => console.log('I want to eat a ’ + fruits));

Nice and simple, and it produced the list as requested. But when looking at this thread I notice people using if/else statements etc. Did I miss an instruction or something?

Nope, you didn’t miss anything. Seems some people just want an additional challenge

the only thing with your code is that you use the same name for the list and the parameter of the callback function, and i wouldn’t do that. Its confusing, and not a logic name for the parameter.

1 Like

ahh good catch, I’ll be more mindful of that in the future. Thanks!