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

Tell us what’s happening:

It is telling me that I should assign the value of ‘monsters[fighting]’ to the ‘monsterHealth’ variable.

I have done so by doing ‘monsters[fighting] = monsterHealth’ but that does not seem to pass.

Your code so far

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

/* file: styles.css */

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

function goFight() {
  update(locations[3]);
  monsters[fighting] = monsterHealth
}

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

Challenge Information:

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

Hi @LowVel0city

You should assign the value of monsters[fighting] to the monsterHealth variable.

Your code is assigning it the other way round.

You also need to access the health property.

Happy coding

Thanks Teller, I had it backwards here because I had tried it the other way around first.

Accessing the health property with dot notation is what I was missing. Thank you

1 Like