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

Tell us what’s happening:

Your buyWeapon function should increase currentWeapon by 1 .

Am I wrong ? I can’t get past this step. Someone tech me please :pray:

Thanks in advance.

### My code below

function buyWeapon(currentWeapon) {
  if (gold >= 30) {
    gold -= 30;
    currentWeapon += 1;
    weapons[currentWeapon];
  }
}
Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

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 85

You added a parameter to this function. Can you think of any reasons why that might cause the test to fail?

Hey @cmmutale, I know you are new here, so this is just some friendly advice. Please don’t provide full code working solutions in here. Our goal is to help people find the answers for themselves by gently guiding them with hints and advice.

1 Like