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

Tell us what’s happening:

Can someone please help me with some clarification on my code. The instruction say: " Display the monsterStats element by updating the display property of the style property to block ." I followed the sample demonstration to set my code formation but, I am still stuck.

Your help will highly be appreciated!

Your code so far

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.

function goFight() {
  update(locations[3]);
  monsterHealth = monsters[fighting].health;
 style.block.display = "monsterStats";
}

Your browser information:

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

Challenge Information:

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

Hey @hiekamara1,

Be sure to look back at what you had previously coded that is in the challenge such as the monsterStats variable here:

const monsterStats = document.querySelector("#monsterStats");

Remember that this is now representative of the element with an id equal to “monsterStats”. What the challenge wants you to do is to now show that element on the screen as a block element.

Remember that you can access CSS through JavaScript by accessing properties of its style (style is for CSS). Like if I wanted to make a paragraph’s background red, I would do this:

myParagraph.style.backgroundColor = 'red';

You should do the same thing with your monsterStats element variable, except that your display should be set to block.

Good luck!

1 Like

Hi,

I’ve just solved this challenge.
You need to change monsterStats.style.display to “block” (with quotation marks).
Otherwise, the “display” property of the “style” property of monsterStats is set to “none” (look into the CSS file).

Good luck!

3 Likes

Welcome to the freeCodeCamp community!

1 Like

Thanks for the warm welcome. Much appreciated

Hi,
Thank you so much for the hint. I just review the CSS style rules I set earlier on. The display property was indeed set to “none”.

thanks once again

1 Like

Very good and best of luck for the future

1 Like

means a lot to my family and I. Wishing you the same man :pray:

1 Like

How long have you been coding?

I’m very sorry but if you all want, you can message each other on here and ask any off topic questions. I’m closing this now.