I can’t seem to figure out why this isn’t working. I’ve tried all the ways I know to.
if (currentWeapon > 3 )
{(function buyWeapon () {
if (gold >= 30) {
gold -= 30;
currentWeapon++;
goldText.innerText = gold;
let newWeapon = weapons[currentWeapon].name;
text.innerText = "You now have a " + newWeapon + ".";
inventory.push(newWeapon);
text.innerText += " In your inventory you have: " + inventory;
} else {
text.innerText = "You do not have enough gold to buy a weapon.";
}
});
}
It keeps saying " You should have a new if
statement that checks if currentWeapon
is less than 3
."