javascript中

it2022-05-09  35

__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

  

 

转载于:https://www.cnblogs.com/simpleminds/p/8550729.html

相关资源:javascript 中__proto__和prototype详解

最新回复(0)