怎样获取当前对象的原型对象prototype

使用 Object.getPrototypeOf();

function Person(name){
    this.name = name;
}

var lilei = new Person("Lilei");
Object.getPrototypeOf(lilei); // {constructor: ƒ}

lilei.constructor.prototype; // {constructor: f}

猜你喜欢

转载自www.cnblogs.com/aisowe/p/11674451.html