Learn basic javascript by building a role playing game -88

Step 88

Use bracket notation to access an object within the weapons array and assign it to your newWeapon variable. Place the variable currentWeaponIndex within the brackets.

When you use a variable in bracket notation, you are accessing the property or index by the value of that variable.

For example, this code uses the index variable to access a value of array.

Sorry, your code does not pass. Hang in there.

  1. You should update newWeapon to have the value of weapons[currentWeaponIndex].

Hi there!

Post a link to the challenge step and also your code.

1 Like