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

Tell us what’s happening: Syntax error, tried everything but couldnt solve it

### Your code so far

function sellWeapon() {
if (inventory.length > 1) {
gold += 15;
goldText.innerText = gold;
let currentWeapon = inventory.shift();
text.innerText = "You sold a " + currentWeapon + “.”;
text.innerText += " In your inventory you have: " + inventory}
else (inventory.length <= 1) {
text.innerText = “Don’t sell your only weapon!”;
}
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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 108

hello and welcome to fcc forum :slight_smile:

  • “else” block dont need any conditions attach to it as “if” or “else if”, remove that
  • for “innerText” value simply copy and paste from “instructions”

happy coding :slight_smile:

1 Like

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