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

Tell us what’s happening:

Although i have increased my current weapon index by 1 using compound assignment it still does not pass anyone who passed this step please elaborate my mistake,

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function buyWeapon(currentWeaponIndex) {
  if (gold >= 30) {
    gold -= 30;
    currentWeaponIndex +=1; 
  }
  weapons[currentWeaponIndex];
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

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

Delete this line.

The instruction only asked to increase currentWeaponIndex by 1.

i have removed it but it still does not pass the code and instructs me to increase currentWeaponIndex by 1

Let me see the code that you made changes to.

its ok the problem is solved now

1 Like