关联两个构造函数的原型,可以在继承或者创建实例(会丢失this)
function create(Base) {
let Fn = function() {};
Fn.prototype = Base;
return new Fn();
}
let s3 = create(Student.prototype); 关联两个构造函数的原型,可以在继承或者创建实例(会丢失this)
function create(Base) {
let Fn = function() {};
Fn.prototype = Base;
return new Fn();
}
let s3 = create(Student.prototype);
评论
使用 GitHub 账号登录后即可评论