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

Tell us what’s happening:

  1. monsterName.innerText = monsters[fighting].name;: This line sets the text content of the element representing the monster’s name to the name of the current monster. The name is retrieved from the monsters array using the index determined by the fighting variable.
  2. monsterHealthText.innerText = monsterHealth;: This line sets the text content of the element representing the monster’s health to the value stored in the monsterHealth variable, which was updated earlier to reflect the current monster’s health.

Your code so far

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

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) 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 116

I tried it on the challenge, and it worked.

can you post your goFight function, maybe you deleted some lines by mistake.

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

I tried your code here and it worked for me. If you have issue with that you can try another browser, clear your cache or disable extensions that you think might cause issue. This happened for many here at the forum and the solution for most of them was by using another browser. As this note at the beginning of the course says:

Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.