I am supposed to build a simple function where a character’s level determines their health.
so:
- It returns the number 100 if level is 0
- It returns the number 150 if level is 1
- It returns the number 180 if level is 2
- It returns the number 190 if level is 3
Using a switch function, I want to say if case is 0, then determineHP is 100. Here is my code thus far:
var determineHP = function(Number) {
switch (determineHP) {
case 0:
console.log(determineHP(0) === 100);
break;
case 1:
console.log(determineHP(1) === 150);
break;
case 2:
console.log(determineHP(2) === 180);
break;
case 3:
console.log(determineHP(3) === 190);
}
}
Obviously this is not correct, any help would be greatly appreciated.