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

Tell us what’s happening:

This is the hint : You should set the innerText property of monsterHealthText to be the health value of the current monster. Remember that you assigned this value to a monsterHealth variable.

Where do I go wrong ?

### Your code so far

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

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0

Challenge Information:

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

I’m in the same place, getting the feedback: “Now, set the innerText property of monsterName to be the name property of the current monster. Do the same for monsterHealthText and the health property.” Here’s my code, where it looks like I’ve done that?

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

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

did it worked with you?

I figured out. I for some reason didn’t see the last line on the feedback that reminded me that monsters[fighting].health had already been assigned to another variable

ok but the thing is I have exactly the same method but still not working

This is what I get for hint:
You should set the innerText property of monsterHealthText to be the health value of the current monster. Remember that you assigned this value to a monsterHealth variable

" Remember that you assigned this value to a monsterHealth variable" ← look at this other variable

I got it
my code passed

Please don’t post solution code. Thanks

fixed, sorry didn’t know

1 Like