Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016年9月.
GeneratorFunction オブジェクトは、ジェネレーター関数のメソッドを提供します。JavaScript では、すべてのジェネレーター関数は実際には GeneratorFunction オブジェクトです。
GeneratorFunction はグローバルオブジェクトではないことに注意してください。次のコードを評価することによって得ることができます。
GeneratorFunction は Function のサブクラスです。
新しい GeneratorFunction オブジェクトを生成します。
親である Function から継承したプロパティもあります。
これらのプロパティは GeneratorFunction.prototype で定義されており、すべての GeneratorFunction インスタンスで共有されます。
GeneratorFunction.prototype.constructorインスタンスオブジェクトを作成するコンストラクター関数です。GeneratorFunction インスタンスの場合、初期値は GeneratorFunction コンストラクターです。
GeneratorFunction.prototype.prototypeすべてジェネレーター関数は、同じ prototype プロパティを共有しており、これは Generator.prototype です。 function* 構文または GeneratorFunction() コンストラクターで生成されたそれぞれのジェネレーター関数も、自身の prototype プロパティを保有しています。このプロパティのプロトタイプは GeneratorFunction.prototype.prototype です。ジェネレーター関数が呼び出されると、その prototype プロパティが返されるジェネレータオブジェクトのプロトタイプとなります。
GeneratorFunction.prototype[Symbol.toStringTag][Symbol.toStringTag] プロパティの初期値は文字列 "GeneratorFunction" です。このプロパティは Object.prototype.toString() で使用されています。
これらのプロパティは、それぞれのGeneratorFunctionインスタンスが自分自身で持っているプロパティです。
prototype関数が new 演算子と共にコンストラクターとして使用される場合に使用されます。新しいオブジェクトのプロトタイプとなります。
親である Function から継承したメソッドがあります。
| ECMAScript® 2027 Language Specification # sec-generatorfunction-objects |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年9月18日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.