function buyHealth() { if (gold >= 10) { gold -= 10; health += 10; goldText.innerText = gold; healthText.innerText = health; } else { text.innerText = "You do not have enough gold to buy health"; } }
My code above receives the response:
" Your buyHealth function should set text.innerText to equal You do not have enough gold to buy health..
else { set text.innerText = to the given text in the challenge
}
In this way, the player would know that he/she is not having enough gold to buy health.