Choose the right Iterator


#1

// 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!


#2

One of those does have undefined as its return value


#3

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


#4

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


#5

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