Tell us what’s happening:
I feel like i have assigned the wrong text. can i get some help with this please.
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;
}
// 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/127.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 119
you were supposed to assign monsters[fighting].name TO => monsterName.innerText
I don’t understand what you mean
In your code, which variable will change after your code executes?
This is your code:
Which of these will be updated when this line of code runs?
Is it the variable on the right of the equals or the one on the left?
up695407:
monsters[fighting].name
is it the right hand side
the value on the left of the equal sign is the one that gets updated.
For eg. if I wrote
x = 4
then x is updated to be equal to 4.
So which variable are you updating when you wrote:
and which one did they want you to update?
up695407:
monsters[fighting].name
i was updating monsters[fighting].name
they want me to update monsterHealthText
i put
monsters[fighting].name = monsterName.innerText;
yes, in your code, which thing is being updated?
and which one did the step want you to update?
hi there!
you have assigned the monsterName.innerText
to monsters[fighting].name
, that is not the correct way to assign anything using innerText
propety.
you need to assign the monsters[fighting].name
to the innerText
of monsterName
.
i think i’m lost now
monsterName.innerText = monsters[fighting].name;
Do you have a specific question about anything?
Here is the next step:
Then, assign monsterHealth
to the innerText
property of monsterHealthText
.
What is the hint saying now?