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

Tell us what’s happening:

my code is like this

function goFight() {
update(locations[3]);
monsterHealth = monsters[fighting].health;
monsterStats.style.display = “block”;
monsters[fighting].name = monsterName.innerText;
monsterHealth = monsterHealthText.innerText;
}

but l am getting this error saying your should assign monsters[fighting].name to monsterName.innerText

Your code so far

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

/* file: styles.css */

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

function goFight() {
  update(locations[3]);
  monsterHealth = monsters[fighting].health;
  monsterStats.style.display = "block";
  monsters[fighting].name = monsterName.innerText;
  monsterHealth = monsterHealthText.innerText;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

Challenge Information:

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

Hello and welcome to our forum!

In both cases monsterName.innerText; and monsterHealthText.innerText; should come first. That way you’ll be assigning them to something.
What you have right now is the exact opposite of what you’re required to do.

thank you, it worked