I'm just learning JS and trying to make a classic wow XP per hour calculator, I set variables of each classes that have attributs [KT(KillTime), KPH(KillsPerHour),XPR(EXP Per Hour).
I can't figure out how to log the solution of the functions I have, and when i try to log warrior.KPH it gives be NaN which i know means not number
var EXP = 278;
var warrior = {
KT: 5.7,
calcKPH: function() {
this.KPH = 3600 / this.KT;
return this.KPH;
},
calcXPR: function() {
this.XPR = this.KPH * EXP;
return this.XPR;
}
}
console.log(warrior);
I expect to be able to add individual attributes to each variable and have a function that calculates the EXP per hour & Kills Per Hour (Sorry i'm still learning the JS grammar)