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

Tell us what is happening:

Your code so far

function buyWeapon() {
  let newWeapon;
  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    let newWeapon = "weapons";
    goldText.innerText = gold;
    text.innerText = "You now have a new weapon.";
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) 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 88

weapons is a variable, not the string "weapons".


Also, you declared newWeapon twice which you shouldn’t (the test doesn’t care).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.