每一个JavaScript对象(除null外)在构建的时会同时关联一个对象,这个对象即为原型,只有函数才有prototype属性,该属性指向对象的原型
2、每一个JavaScript对象都有 一个__proto__属性,该属性指向对象的原型
3、对象的原型上有一个constructor属性,指向该对象
例子:
function A(){ }
let aa = new A() // 实例化
console.log(aa.__proto__ === A.prototype) // true
console.log(aa.__proto__.constructor === A) //true
console.log(A.prototype.constructor === A) //true
console.log(Object.getPrototypeOf(aa) === A.prototype) // true Object.getPrototypeOf( ) 获取对象原型ES5方法
问题:Object.getPrototypeOf(A) 获取的是什么??