Saturday, September 6, 2025
HomeLanguagesJavascriptJavaScript Generator constructor Property

JavaScript Generator constructor Property

JavaScript Generator constructor property is used to return the Generator constructor function for the object. The function which is returned by this property is just the reference to this function, not a Generator containing the function’s name. The JavaScript number constructor, string constructor, and generator constructor return function Number() { [native code] }, function String() { [native code] }, and GeneratorFunction() { [native code] } respectively.

Syntax:

generator.constructor

Return Value: function GeneratorFunction() { [native code] }

Below are examples of the Generator constructor Property. 

Example 1: This example shows the basic usage of the Generator constructor property in JavaScript.

Javascript




function* func() {}
console.log(func.constructor);


Output:

Ć’ GeneratorFunction() { [native code] }

Example 2: This example uses the Generator constructor Property of Javascript.

Javascript




function myGeeks() {
    function* func() { }
 
    console.log(func.constructor);
}
myGeeks()


Output:

JavaScript Generator constructor Property

JavaScript Generator constructor Property

Supported Browsers:

  • Chrome
  • Edge 
  • Firefox
  • Opera
  • Safari

We have a complete list of JavaScript Generator methods, to check those please go through, the JavaScript Generator Reference article

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32270 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS