jskatas.org Continuously Learn JavaScript. Your Way.

Generator: send value to a generator

By calling next() with a parameter, you can pass a value to a generator.

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.

Pass a value to a generator

  • basics: get the values from a generator in two ways
  • pass a value to the iterator
  • a value passed to the 1st next() call is ignored


The part in the spec, that describes how a generator resumes.