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

Tell us what’s happening:

Feel like i entered it in correctly but it keeps erroring telling me the first element should have the provided text “XP: 0”

Your code so far

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    <title>RPG - Dragon Repeller</title>
  </head>

<!-- User Editable Region -->

  <body>
    <div id="game">
      <div id="stats">
<span class="stat">
XP: 0
</span>
<span class="stat">
Health: 100
</span>
<span class="stat">
Gold: 50
</span>
      </div>
      <div id="controls"></div>
      <div id="monsterStats"></div>
      <div id="text"></div>
    </div>
  </body>

<!-- User Editable Region -->

</html>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0 (Edition std-1)

Challenge Information:

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

Welcome to the community!

I just placed it all on one line.
I had to do this with both the first and second stat.
It never required a change to the third one, but it might be a good idea to have them all on the same line as their opening element.

Wishing you good progress!

1 Like

I am having this same issue and it does not seem to work. <div id="stats"> <span class="stat"> XP: 0 </span> <span class="stat"> Health: 100 </span> <span class="stat"> Gold: 50 </span> </div>

Your first .stat element should have the provided text XP: 0 .

Welcome back to the community @Sanyaolu ! Nice to see you!

Could you please use the Help that appears after three failed attempts on a step?

This way, your complete code is available to be posted through preformatting, and you can post your questions and any error messages received for the code.

It also allows the community to provide focused, quick and accurate guidance to help you resolve the problem with the code.

Thank you!

Wishing you good progress!

1 Like