Announcing Stack Overflow Documentation



Sign up and start helping → Learn more about Documentation →

(__proto__ property refers to the actual prototype of an object.)

Object is a function (and also used as a constructor).

Since it is a function, it's constructor should be Function.

So, if I wanted some property added to Object, I could add it to Function.prototype.

But, Function is an object and all objects inherit from Object in some way.

Is this actually a cyclic relation?

I read this in an MDN page :

(some function) ---> Function.prototype ---> Object.prototype ---> null

How can null be the __proto__ of Object? Isn't it Function.prototype again?

share|improve this question
Take a look at this answer: stackoverflow.com/questions/650764/…. – Andries Dec 13 '12 at 10:35
@Andries, Thanks! – batman Dec 25 '12 at 16:57
up vote 0 down vote accepted

After reading up on this, I think the diagram in this answer, answers the question.

Every object in Javascript is has a __proto__ property which is the same as it's constructor's prototype property. So, if a property of an object isn't found, it looks it up in it's __proto__ property and upwards like that, until it either finds it or reaches null.

Object.prototype is THE end of the prototype chain, with Object.prototype.constructor being Object.

The fact that Object is a function, would mean that, Object.__proto__ is Function.prototype(because Object could have been created as new Function())

but not that Object.prototype.__proto__ is Function.prototype.

So, the __proto__ chain goes Function.prototype --> Object.prototype --> null

I hope I got it right.

share|improve this answer

If I understand correctly, Function and Object hold the top positions together. Since Function has an Object as it's prototype, and Object, as a constructor, is actually a Function.

This sort of mutual dependency/inheritance is common on fully OO languages, and can become much more complicated that this (rather simple) two-item version. Take a look at Ruby's inheritance diagram (in beautiful ascii art!) to see how brain-wrenching it can be :)

The good thing is, you usually don't have to worry about it. It should Just Work™.

share|improve this answer

Your Answer


