Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
The Generator object is returned by a generator function and it conforms to both the iterable protocol and the iterator protocol.
GeneratorFunction.prototype.prototype
There's no JavaScript entity that corresponds to the Generator constructor. Instances of Generator must be returned from generator functions:
Generator.prototype.constructor
The constructor function that created the instance object. For Generator instances, the initial value is GeneratorFunction.prototype.
The constructor function that created the instance object. For Generator instances, the initial value is GeneratorFunction.prototype.
The initial value of the [Symbol.toStringTag] property is the string "Generator". This property is used in Object.prototype.toString().
The initial value of the [Symbol.toStringTag] property is the string "Generator". This property is used in Object.prototype.toString().
Acts as if a return statement is inserted in the generator's body at the current suspended position, which finishes the generator and allows the generator to perform any cleanup tasks when combined with a try...finally b
Acts as if a return statement is inserted in the generator's body at the current suspended position, which finishes the generator and allows the generator to perform any cleanup tasks when combined with a try...finally b
Acts as if a return statement is inserted in the generator's body at the current suspended position, which finishes the generator and allows the generator to perform any cleanup tasks when combined with a try...finally b
This page was last modified on Jan 24, 2026 by MDN contributors.