美文网首页
我理解的原型链和原型对象

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

作者: 晒雨LL | 来源:发表于2018-01-22 18:03 被阅读0次

    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

    相关文章

      网友评论

          本文标题:我理解的原型链和原型对象

          本文链接:https://www.haomeiwen.com/subject/glhraxtx.html