“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