Learn Basic JavaScript by Building a Role Playing Game: Step 106

“I think I am doing it correctly, but I am still getting an error. Please help me correct this challenge.”
my code:

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;
    
  }
}

challenge:Learn Basic JavaScript by Building a Role Playing Game: Step 106

Hi @vileshBandekar

Your code passes.
Reset the step and try again. If that doesn’t work, refresh the page, disable dark mode, disable ad blockers. Or, use another browser.
If the above steps do not work, you may need to restart the computer.

Happy coding

1 Like

right code is

Mod Edit SOLUTION REMOVED

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