注意 constructor 的指向
function Person(name,age){
this.name = name;
this.age = age;
}
Person.prototype.eat = function(){}
var obj ={
construction:Person,
eat(){},
play(){}
}
Person.prototype = obj;
注意 constructor 的指向
function Person(name,age){
this.name = name;
this.age = age;
}
Person.prototype.eat = function(){}
var obj ={
construction:Person,
eat(){},
play(){}
}
Person.prototype = obj;