Object.getPrototypeOf() 静态方法返回指定对象的原型。
语法形式:
Object.getPrototypeOf(obj)
其中,参数obj代表要返回其原型的对象。
示例:
const obj1 = {
name: 'tom',
age: 20
}
const obj2 = Object.create(obj1)
console.log(Object.getPrototypeOf(obj2))
console.log(Object.getPrototypeOf(obj2) === obj1)
输出: