Step 118, How can I solve it?

Step 118

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.

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

1 Like

You set the monsterName to the name property and you also set the monsterHealth to the name property. You want those to be the same?

yes. I want to

But how?

Look at the instructions again, it’s not asking them to be the same.

set the innerText property of monsterName to be the name property of the current monster

Do the same for monsterHealthText and the health property.

So, set the innerText property of monsterHealthText to be the health property of the current monster. It wouldn’t make sense to set the monster health to the name, right?

Yes/ but I tryed 5 methods, and it doesn’t work!

The line you need to fix is this one

specifically the issue is this part here

You are assigning the wrong value to monsterHealthText.innerText

Re read through the last part of the hint text to see the correct answer they give you to fix this

Quote from the hint text:

Remember that you assigned this value to a monsterHealth variable.

Then the test will pass

Assign monsters[fighting].health to monsterHealthText.innerText

2 Likes

REDACTED

I solved it, and I understood thx so!

2 Likes

Great, happy to help!

Please don’t post the solution code in the forum though, don’t want to spoil it for others who are trying to learn and don’t want to see the answers accidentally.

This was already solved over a month ago

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.