Learn Basic JavaScript by Building a Role Playing Game - Step 96

Tell us what’s happening:

I’m at step 96 and i can’t understand why it keeps telling me to add the new if statement when i already did?

Your code so far

function buyWeapon() {
  if (currentWeapon <= 3) {
  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.";
  }
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 96

Check the operator, the condition should check whether currentWeapon is less than three

2 Likes

yess thank you i just saw it, sorry i´m kinda dumb lolz

1 Like

4 posts were split to a new topic: Learn Basic JavaScript By Building a Role Playing Game - Step 96