javascript中__proto__和prototype的区别
__proto__是真正的原型链,对象特性在__proto__上查找。
prototype是构造__proto__的对象。
两者存在联系,用代码表示
function Robot(name) {
this.name = name;
}
var robot = new Robot();
// the following are true
robot.__proto__ == Robot.prototype
robot.__proto__.__proto__ == Object.prototype
浙公网安备 33010602011771号