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

Tell us what’s happening:

I have been stuck here for days. No previous tips or articles have helped me. I have used the obj.key dot notation to acces the Text property for text.innerText but still can’t change it to text.innerHTML

Like This:

text.innerText = location.text[5];
document.querySelector(text.innerText).innerHTML = “You die. :skull_and_crossbones:

Your code so far

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

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

  monsterStats.style.display = "none";
  button1.innerText = location["button text"][0];
  button2.innerText = location["button text"][1];
  button3.innerText = location["button text"][2];
  button1.onclick = location["button functions"][0];
  button2.onclick = location["button functions"][1];
  button3.onclick = location["button functions"][2];
  text.innerText = location.text[5];
  document.querySelector(text.innerText).innerHTML = "You die. &#x2620;"

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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 141

Reset the step and then find the line that has this variable.
Change the word innerText to innerHTML

That is all they needed.

1 Like

My goodness. That resolved it. Thank you.

1 Like