DEV Community

Cover image for What's the difference between __proto__ and prototype?
Anil Singh
Anil Singh

Posted on

What's the difference between __proto__ and prototype?

The proto a reference works on every object to refer to its [[Prototype]]property.

The prototype is an object automatically created as a special property of a function, which is used to store the properties (including methods) of a function object.
With these two, we could mentally map out the prototype chain.

Alt Text

As an Example,

function Foo() {}

var b = new Foo();

b.__proto__ === Foo.prototype // true
Foo.__proto__ === Function.prototype // true
Function.prototype.__proto__ === Object.prototype // true

You should check out the docs.

Top comments (0)