JS中的__proto__和prototype

  • 每个对象都有__proto__属性,指向了构造该对象的prototype
  • 构造函数有prototype属性,prototype的constructor属性又指向了该构造函数。prototype也是对象,是由Object构造的。
  • 构造函数的__proto__属性指向Function的prototype,说明构造函数是由Function对象构造的。
  • Function也是个对象,但是是由自己构造的,即Function._proto_=Function.prototype
  • Object.prototype这个对象比较特殊,Object.prototype._proto_ =null

JS中__proto__和prototype

相关文章:

  • 2021-11-20
  • 2021-09-06
  • 2022-01-20
  • 2021-11-06
  • 2021-12-20
  • 2021-07-13
  • 2021-08-14
  • 2021-10-02
猜你喜欢
  • 2022-01-03
  • 2021-04-27
  • 2021-08-29
  • 2021-11-08
  • 2021-04-16
  • 2021-07-25
  • 2021-09-13
相关资源
相似解决方案