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

Tell us what’s happening:

Not sure where my code is incorrect. Looks correct in the preview and the span is nested. Any ideas guys?


Your code so far

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

<!-- User Editable Region -->

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

<!-- User Editable Region -->

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

Your browser information:

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

Challenge Information:

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

Put each stat on the same line so you can ensure the spacing
(1 space after XP: for example)

XP:0 vs 
XP: 0
<span class="stat">XP: <strong>

This will make the spacing more obvious

Thank you, but i tried that and it didn’t work.


Hey there,

Your code seems to be correct and yet, for passing this step I would suggest you to child the <strong>...</strong> element inside each <span class="stat">...</span> element without entering a new line by pressing Enter. If done right, this should definitely work as it did for me.

Happy Coding :keyboard: !