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

Tell us what’s happening:

what’s wrong with my code?

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>
  <body>
    <div id="game">
      <div id="stats">

<!-- User Editable Region -->

        <span id="xpText" class="stat">XP: <strong>0</strong></span>
        <span id="healthText" class="stat">Health: <strong>100</strong></span>
        <span id="goldText" class="stat">Gold: <strong>50</strong></span>

<!-- User Editable Region -->

      </div>
      <div id="controls"></div>
      <div id="monsterStats"></div>
      <div id="text"></div>
    </div>
  </body>
</html>

Your browser information:

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

Hey @raditcoding29
You are doing great you need to wrap the numbers inside a span and wrap the spanspan inside a stong tag like so

<stong><span>text</span></stong>

Happy coding

1 Like

Hi, thank you.
But it still didn’t work, is there anything else i missed?

XP: 0
Health: 100
Gold: 50

Can you post your updated code

1 Like
<span id="xpText" class="stat">XP: <strong><span>0</span></strong></span>
        <span id="healthText" class="stat">Health: <strong><span>100</span></strong></span>
        <span id="goldText" class="stat">Gold: <strong><span>50</span></strong></span>

is there any code i missed?

" give your new span elements id values of xpText , healthText , and goldText , respectively."

You’re not giving the new span elements the ids, but instead you are giving the ids to the span elements that the challenge gave you. The ids need to go in the spans that you created

It works, thank you :smile: