UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Global Objects/ GeneratorFunction

The GeneratorFunction object provides methods for generator functions. In JavaScript, every generator function is actually a GeneratorFunction object.

Note that GeneratorFunction is not a global object. It can be obtained with the following code:

const GeneratorFunction = function* () {}.constructor;

GeneratorFunction is a subclass of Function.

Constructor

Instance properties

Also inherits instance properties from its parent Function.

These properties are defined on GeneratorFunction.prototype and shared by all GeneratorFunction instances.

Instance methods

Inherits instance methods from its parent Function.

Specifications

Browser compatibility

See also