【发布时间】:2019-05-24 15:43:28
【问题描述】:
无法弄清楚为什么我会收到未定义统计信息的错误...
我尝试过命名和重命名,调用之前命名的函数仍然报错
function GameObject(GO){
this.createdAt = GO.createdAt;
this.name = GO.name;
this.dimensions = GO.dimensions;
}
GameObject.prototype.destroy = function(){
return `${this.name} was removed from the game.`;
}
function CharacterStats(stats){
GameObject.call(stats);
this.healthPoints= stats.healthPoints
}
CharacterStats.prototype = Object.create(GameObject.prototype)
CharacterStats.prototype = takeDamage = function(){
return `${this.name} took damage`;
}
function Humanoid(PettyHumans){
this.team = PettyHumans.team;
this.weapons = PettyHumans.weapons;
this.language = PettyHumans.language;
CharacterStats.call(this.PettyHumans)
}
Humanoid.prototype.greet = function(){
return `${this.name} offers a greeting in ${this.language}.`;
}
【问题讨论】:
-
在哪里您遇到此错误? (上面哪一行。)
标签: javascript this prototype operator-keyword