Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how come object.prototype inherits from function.prototype?

Status
Not open for further replies.

LPent

Programmer
Oct 3, 2002
50
TR
I am trying to get to the bottom of javascript object, prototypes etc.
I have a fairly good grasp of it, but I get confused the closer I get to the base object.prototype.

First of all, I was under the impression that all objects descend directly from Object. But some objects (like Array) seem to inherit properties and methods from the function.prototype as well. So does this mean that the chain is like this:

object -- function -- array ?

Second, I noticed (on the mozilla javascript reference site) that object.prototype inherits properties and methods from function.prototype and vice versa!?
How can this be? I must be missing something important about understanding the chain?
Can someone explain these two issues to me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top