jskatas.org Continuously Learn JavaScript. Your Way.

Generator: iterator

Generators return iterable objects

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Generators returns an iterable object

  • a generator returns an object
  • a generator object has a key Symbol.iterator
  • the Symbol.iterator is a function
  • can be looped with for-of, which expects an iterable