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

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

I don't know why the code does not pass but I did everything like I was supposed to 
<!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">

<!-- User Editable Region -->

        <div id="stats">
        
            <span class="stat">XP: 
                <strong>
                    <span id="xpText">0</span>
                </strong>
            </span>
            <span class="stat">Health: 
                <strong>
                    <span id="healthText">100</span>
                </strong>
            </span>
            <span class="stat">Gold:
                <strong>
                    <span id="goldText">50</span>
                </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 (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 4

put opening strong elements in front of the text

<strong >XP:

do it for all text

i tried it but is still not working

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

Actually, I believe you were correct the first time, since it says wrap the numbers:

Wrap the numbers 0, 100, and 50 in span elements, and wrap those new span elements in strong elements.

The problem seems to be the spacing when you break it up on multiple lines. I think it’s getting confused if there is a space or not (XP:0 vs XP: 0). Use your original code, but all on one line like your last code. Putting it on one line will make the spacing clear.

put ending strong in front of thr ending span

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

Congratulations…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.