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

Challenge Information:

Learn Basic JavaScript by Building a R
ole Playing Game - Step 105

Please where am i getting it wrong?
The shift() method on an array removes the first element in the array and returns it. Use this method to take the first element from the inventory array and assign it to your currentWeapon variable.
function sellWeapon() {
if (inventory.length > 1) {
gold += 15;
goldText.innerText = gold;
let currentWeapon;
return currentWeapon.shift(inventory[0]);
}
}

you need to use shift on the array, and it doesn’t take any arguments, you are using it on currentWeapon, which is not an array

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