__proto__和prototype的相关区别

function Person(name){
  this.name = name
}
let person = new Person('xiaoming')
person.__proto__ === Person.prototype

对象的__proto__ === 构造函数的prototype

Person.__proto__ === Function.prototype

Person函数是Function函数的实例所以Person.__proto__等于Function.prototype

Fcuntion.__proto__===Function.prototype

Function也是一个普通函数,普通函数的__proto__等于Function.prototype

Function.prototype.__proto__ === Object.prototype

Function.prototype.__proto是一个原型对象,对象是通过Object构造函数生成的

Object.__proto__ === Fcuntion.prototype

Object构造函数是Function的实例

posted @ 2022-05-17 15:53  zeal666  阅读(23)  评论(0)    收藏  举报