javascript的prototype链

The true prototype of an object is held by [[Prototype]] internal property:

function Foo () {}
var bar = new Foo();  //the [[Prototype]] of bar is Foo.prototype

function Baz () {}  //
Baz.prototype = new Foo();  //the [[Prototype]] of Baz.prototype is changed to Foo.prototype.

 
javascript的prototype链

上图都是函数的prototype链,记住Object是javascript中的Object函数对象。

在javascript中一切都是对象,但是对于真正的对象的prototype链则如下:


javascript的prototype链