Course contentsShow
← JavaScript
Lesson 718 of 2,72317. Prototypes and InheritanceFree lesson

The prototype.constructor Back-Reference

By default, Func.prototype.constructor points back to Func itself.

The prototype.constructor Back-Reference

You'll learn how every function's prototype object automatically includes a reference back to the function itself.

What Is the constructor Property?

When you create a function in JavaScript, the engine automatically creates a prototype object for it. Inside that prototype object, there's a special property called constructor that points back to the original function.

Think of it like a business card inside a brochure—the brochure (prototype) contains contact information (constructor) that points back to the company (function) that created it.

function Dog(name) {
  this.name = name;
}

// The prototype.constructor points back to Dog
console.log(Dog.prototype.constructor === Dog); // true

Why Does This Exist?

This back-reference allows instances to identify which constructor function created them:

const buddy = new Dog("Buddy");

// From the instance, we can access the constructor
console.log(buddy.constructor === Dog); // true

Notice buddy doesn't have its own constructor property—it inherits it from Dog.prototype through the prototype chain.

The Full Circle

Here's the relationship:

  1. Dog is a function
  2. Dog.prototype is an object
  3. Dog.prototype.constructor points back to Dog
  4. Instances created with new Dog() inherit this constructor property
console.log(Dog.prototype.constructor);        // [Function: Dog]
console.log(buddy.__proto__.constructor);      // [Function: Dog]
console.log(buddy.constructor);                // [Function: Dog]

All three access the same property—the constructor back-reference stored in the prototype.

Key Takeaway: Every function's prototype object automatically contains a constructor property that references the function itself, creating a two-way link between constructor and prototype.