Friday, February 6, 2026
HomeLanguagesJavascriptJavaScript Object.prototype.constructor Property

JavaScript Object.prototype.constructor Property

The constructor property returns a reference to the object constructor function that has created the instance of an object. The value of the constructor is not a string containing the function’s name, but it is a reference to the function itself.

Syntax:

Object.constructor

Return Value: It is a reference to the object of constructor.

Example 1: Below example illustrates how to display the constructor of an object.

Javascript




function Gfg(name) {
    this.name = name
}
let neveropen = new Gfg('Geeks');
console.log(neveropen.constructor);


Output:

Example 2: Below example illustrates how to change the constructor of an object.

Javascript




function Types() { }
let types = [
    new Array(),
    [],
    new Boolean(),
    false,
    new Date(),
    new Error(),
    new Function(),
    new RegExp(),
    /(?:)/
]
let j = 0;
while (j < types.length) {
    types[j].constructor = Types
    types[j] = [types[j].constructor,
    types[j] instanceof Types,
    types[j].toString()]
    ++j;
}
console.log(types.join('\n'));


Output:

Browser supported:

  • Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer 11 and above
  • Opera 9.5 and above
  • Safari 3 and above
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
32489 POSTS0 COMMENTS
Milvus
126 POSTS0 COMMENTS
Nango Kala
6862 POSTS0 COMMENTS
Nicole Veronica
11983 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12073 POSTS0 COMMENTS
Shaida Kate Naidoo
6995 POSTS0 COMMENTS
Ted Musemwa
7236 POSTS0 COMMENTS
Thapelo Manthata
6946 POSTS0 COMMENTS
Umr Jansen
6930 POSTS0 COMMENTS