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

I can´t see what I did wrong… it says to change your currentWeapon assignment to use the increment operator.

function buyWeapon() {currentWeapon="num++";
  if (gold >= 30) {
    gold -= 30;

Please post a link to the step. Thanks

This looks suspicious. That probably shouldn’t be in that location, and it probably shouldn’t go in ""s.

i put it inside the “if” statement and removed the “”, still wrong.

What is your updated code?

Also, please post a link to the step.

function buyWeapon( ){
if (gold >=30) {
gold -=30;

Hmm, this probably doesn’t do what you want. Use the ++ operator directly on the currentWeapon variable


it worked! thank you!

1 Like