我理解的原型链和原型对象

2018-01-22  本文已影响0人  晒雨LL

1. 我的理解

原型链是一种链式继承 ,体现在 __proto__
原型对象是一个对象 ,即 prototype

//原型链继承  可以看成__proto__继承自 parent prototype, 直至Object.__proto__==null
instance.__proto__ = class/function .prototype 

class/function.prototype.constructor = instance.__proto__.constructor = class/function

Function.prototype = {
  constuctor: Function
  __proto__: parent prototype
}

2. 看张图吧
image
参考
https://www.jianshu.com/p/aa1ebfdad661/
https://www.cnblogs.com/shuiyi/p/5305435.html
上一篇 下一篇

猜你喜欢

热点阅读