码迷,mamicode.com
首页 > 其他好文 > 详细

prototype和__proto__区别

时间:2017-11-19 16:05:56      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:obj   span   prot   let   代码   fun   on()   直接   prototype   

prototype和__proto__分别是显式原型和隐式原型,直接上代码吧:

function person(){
    this.age = 12;
}
person.prototype; //Object
let person1 = new person();
person1.__proto__; // Object
person1.__proto__ == person.prototype; //true

可以看到显式原型和隐式原型是一样的~~

prototype和__proto__区别

标签:obj   span   prot   let   代码   fun   on()   直接   prototype   

原文地址:http://www.cnblogs.com/amiezhang/p/7859943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!