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

Tell us what’s happening:

I’m not sure how to call on my style property. I’ve tried a couple different ways and researched how to call on an external css on java but I couldn’t find exactly what I was looking for. Can someone help guide me in the right direction?

Step 117

The HTML element that shows the monster’s stats has been hidden with CSS. Display the monsterStats element by updating the display property of the style property to block. For example, updating the first property of the name property of user would look like:

user.name.first = "Naomi";

Your code so far

function goFight() {
  monsterHealth = monsters[fighting].health;
  styles.monsterStats.display = "block";
/* Uncaught ReferenceError: styles is not defined
  Things I've tried:
  style.monsterStats.display = "block";
  styles.monsterStats.display = "block";
  styles.css.monsterStats.display = "block";
  stylesheet.monsterStats.display = "block";
  monsterStats.display = "block";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

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

1 Like

Evening there @BeGlad ,

The best way to think about it is a chain. You’re targeting monsterStats and you want to go into style, and then set display to block . Much like a directory, really.

user.name.first = “Naomi”;

Hopefully this guides you in the right direction without spoiling the solution. If not, let me know!

1 Like

Thank you so much @KTO ! Great description, I got the correct answer. Although, I still don’t entirely understand why it is positioned the way it is though. In my mind I should access the stylesheet first then the object of monsterStats then the display property. Also I don’t understand how we are accessing the style property when the sheet is called “styles”

1 Like

I was in the same boat myself, so I get it – this helped me out and can explain it higher than my skill level allows me to!

Glad you got your solution, that was a tricky one.

1 Like

This is messed up. This doesn’t match with the current step. What is wrong here?