I think there's maybe a minor correction, where you state that a Generator's return value is an iterator object since it follows the iterator protocol as they implement the @@iterator method stored in their key [Symbol.iterator] ... so, technically, an object follows the iterator protocol when they implement the next() method, and it follows the iterable protocol when it implements the @@iterator method.
By the way, I couldn't figure out when exactly can we call an object and iterator. What if an object implements just the next() method, or just the @@iterator method, will it be an iterator? Also, would it make sense to have just one of those methods ... I guess I'll keep reading more on it.
Anyways, thanks so much for posting such timeless, incredibly valuable, and easier to digest study materials :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think there's maybe a minor correction, where you state that a Generator's return value is an iterator object since it follows the iterator protocol as they implement the @@iterator method stored in their key [Symbol.iterator] ... so, technically, an object follows the iterator protocol when they implement the next() method, and it follows the iterable protocol when it implements the @@iterator method.
By the way, I couldn't figure out when exactly can we call an object and iterator. What if an object implements just the next() method, or just the @@iterator method, will it be an iterator? Also, would it make sense to have just one of those methods ... I guess I'll keep reading more on it.
Anyways, thanks so much for posting such timeless, incredibly valuable, and easier to digest study materials :)