CodeZettaInterview Hub

JavaScript · Prototype · Junior · Comparison

What is the difference between `Fn.prototype` and `obj.__proto__` / `[[Prototype]]`?

Short Interview Answer

`Fn.prototype` is the object that will become `[[Prototype]]` of instances created with `new Fn()`; `__proto__` accesses an object's actual prototype link.

Detailed Explanation

Functions (that are constructors) have a `.prototype` property used when `new` runs: the new object's `[[Prototype]]` is set to `Fn.prototype`. Instances do not have a `.prototype` property by default. `__proto__` is a legacy accessor for `[[Prototype]]`; prefer `Object.getPrototypeOf` / `Object.setPrototypeOf`. Changing `Fn.prototype` after instances exist does not rewire already-created objects unless they still point at the same object reference you mutate.

Example

function User(name) {
  this.name = name;
}
User.prototype.say = function () {
  return this.name;
};
const u = new User('Ada');
Object.getPrototypeOf(u) === User.prototype; // true

Interview Tip

Draw: Constructor → `.prototype` → instance `[[Prototype]]`.

Common Mistake

Using `obj.prototype` on instances expecting the chain link.

Did you know this answer?