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

Tell us what’s happening:

not sure what is happening but i keep getting You should use the concatenation operator to add the current weapon to the string. You can get the current weapon with weapons[currentWeaponIndex].name.

Your code so far

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

/* file: styles.css */

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

function attack() {
  text.innerText = "The " + monsters[fighting].name + " attacks.";
text.innerText += " You attack it with your " + weapons
[currentWeaponsIndex].name + ".";
}

// 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/130.0.0.0 Safari/537.36

Challenge Information:

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

typo. currentWeaponIndex

Hi @ryanstruckus

The blue dots indicate at typo in the variable name.

image

Happy coding

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