AceDevHub
Intermediate JavaScript Interview QuestionsIntermediateComparison

JavaScript · Question 40

What is the difference between a function’s prototype property and an object’s prototype link?

Direct answer

A constructable function’s prototype property is an ordinary object used by new when creating instances; an object’s internal [[Prototype]] is the link used for inherited property lookup.

These two ideas are related but not interchangeable. In function User(){}, User.prototype is a property on the constructor function. If you execute const u = new User(), the new object’s internal prototype is normally set to that User.prototype object.

You can inspect an object’s actual prototype with Object.getPrototypeOf(u). The historical __proto__ accessor exposes similar functionality on many ordinary objects, but modern code should prefer the standard Object.getPrototypeOf() and Object.setPrototypeOf() APIs when such access is really needed.

  • Constructor.prototype → ordinary property used as the prototype for instances created by new.
  • Object [[Prototype]] → internal inheritance/delegation link used during property lookup.
  • Arrow functions are not constructors and do not have the normal constructor prototype property.