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

Tell us what’s happening:

hello,

I am trying to get a better understand of how

monsterStats.style.display = “block”;

actually works. I guess ‘block’ refers to an html block? Why is it that when you set this to “block” it makes the text appear? What are some other things you can do with style.display? I don’t even need a written explanation, even a link to a resource that explains this would be great. Thank you!

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;

}

// User Editable Region

Your browser information:

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

Challenge Information:

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

this is setting the display css property of that element, if you check the css it is set to display: none on line 28, and display: none means it is not visible, so setting it to display: block cancel that display: none and makes it visible

Thank you very much!