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

I cannot figure out what is wrong with this code. I keep moving around the strong element but nothing works

XP: 0

Health: 100

Gold: 50

<!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 -->

<strong><span id="xpText" class="stat">XP:</strong> 0</span><span ></span>
<strong><span id="healthText" class="stat">Health:</strong> 100 </span><span ></span> 
<strong><span id="goldText" class="stat">Gold:</strong> 50</span><span ></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/116.0.0.0 Safari/537.36

Challenge Information:

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

I would reset it and try again, you definitely should not end up with something like the above and you should’nt have interleaved openings and closings as you have now.

">XP:</strong> 0</sp
I would try to make sure the space comes after XP: and not in front of the 0 like this, I think it would be better for the test.
">XP: </strong>0</sp

The number should be wrapped in <span> and <strong> but your <strong> ends before the number:

</strong> 0
</strong> 100

thanks all I got it to work.

1 Like