const person = function (name){
this.name = name
}
person.prototype.getName = function(){
return this.name
}
let oF = function() {
let obj = {};
let c = [].shift.call(arguments)
obj.__proto__ = c.prototype
c.apply(obj, arguments);
return obj
}
let a = oF(person, '666666')
console.log(a)
console.log(a.name)
console.log(a.getName())
网友评论