问题:
This figure again shows that every object has a prototype. 该图再次显示每个对象都有一个原型。 Constructor function Foo also has its own
__proto__
which is Function.prototype, and which in turn also references via its__proto__
property again to the Object.prototype. 构造函数Foo还具有自己的__proto__
,即Function.prototype,而该__proto__
又通过其__proto__
属性再次引用了Object.prototype。 Thus, repeat, Foo.prototype is just an explicit property of Foo which refers to the prototype of b and c objects. 因此,重复一遍,Foo.prototype只是Foo的显式属性,它引用b和c对象的原型。
var b = new Foo(20);
var c = new Foo(30);
What are the differences between __proto__
and prototype
? __proto__
和prototype
什么区别?
The figure was taken from dmitrysoshnikov.com . 该图取自dmitrysoshnikov.com 。
解决方案:
参考一: https://stackoom.com/question/fmyl/proto-VS-JavaScript原型参考二: https://oldbug.net/q/fmyl/proto-VS-prototype-in-JavaScript
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4255683