es5 构造函数

54 阅读1分钟
function Parent(){
    this.name = 'name';
    this.method = function(){
        console.log(this.name);
    }
}
var a = new Parent()

1.实例的__proto__指向构造函数Parent的原型; (a.proto === Parent.prototype) (a.proto === a.constructor.prototype)

www.jianshu.com/p/8a1a60709…