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

I have no idea where should I be adding another else statement:

My code

function buyWeapon() {
  if (currentWeapon < weapons.length - 1) {
    else {
      text.innerText: "You already have the most powerful weapon!";
    }
    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.";
    } 
  } 
}

Challenge Information:

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

Hi @chiragsharma8219

The else statement should be the other most statement, so not at the top. Hint, how to make it the last statement?

Also please change the colon to an equals sign, or the text will not modify.

Happy coding

2 Likes

Dude, thanks for pointing it out, I had no idea, that I was not able to point out that small mistake.

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