JavaScript中的__proto__、[[prototype]]和prototype | GCidea's blog
__proto__与[[prototype]]相关介绍 待续。
一张图分析三者的关系
一系列案例分析12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.prototype === Foo.prototype); //false12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.__proto__ === Foo.prototype); //true12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.prototype); //undefined12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.__proto__); //object{}123456function Foo(){ co...阅读全文
一张图分析三者的关系
一系列案例分析12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.prototype === Foo.prototype); //false12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.__proto__ === Foo.prototype); //true12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.prototype); //undefined12345function Foo(){ console.log(1);}var a = new Foo();console.log(a.__proto__); //object{}123456function Foo(){ co...阅读全文