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

Tell us what’s happening:

The console is telling me that I should assign monsters[fighting].name to monsterName.innerText and monsterHealth to monsterHealthText.inner Text.

You should assign monsters[fighting].name to monsterName.innerText.
You should assign monsterHealth to monsterHealthText.innerText.

My code says

monsters[fighting].name = monsterName.innerText;
monsterHealth = monsterHealthText.innerText;

I’ve checked for typos, I’ve copy and pasted to make sure I didn’t miss typos or spell anything wrong.

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

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

your code is assigning monsterName.innerText to monsters[fighting].name, remember what is the direction of the assignment

1 Like

I actually just realized that at the same time :melting_face: 2 days later lol. Thank you!