Choose the right Iterator


// Choose a method that will return undefined
cities.method(city => console.log('Have you visited ’ + city + ‘?’));

//Above there is an array of cities

I’ve tried the other methods we learned earlier in the lesson,. forEach(), .map(), .filter(), none of them are methods that are returning as undefined.

I’ve also searched the MDN web docs website for options but nothing is jumping out at me.
It’s been a while since I’ve practiced any coding so any extra tips or suggestions would be appreciated, Thanks!


One of those does have undefined as its return value


Sheesh, I tried all those several times and they did not work.
Now it works.


Which one returned undefined, if you don’t mind my asking?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.