+ 4
JS Progress Bars
So what im wondering is if you check the javascript for the heal function the only way i could find to not be able to use heal if health is at 100 is using the return. Is there any other way (particularly better/cleaner) to do this? https://code.sololearn.com/WNzAAOfYBsHl/?ref=app
3 odpowiedzi
+ 27
function heal() {
let health = document.getElementById("health")
let mana = document.getElementById("mana")
if (health.value < 100) {
if (mana.value < 15) {
health.value += 0;
}
if (mana.value > 15) {
health.value += 10;
mana.value -= 15;
}
}
}
+ 3
Thank you ValentinHacker!!! and i know Edward i just ran into this problem in the middle of creating it. Im going to make spells a dropdown list that includes heal
0
you forgot function spells()