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

What’s happening:

Well, I guess I just didn’t understand the directions, because I just know what the error code mean…
Here what it says:
" You should add a strong element in your first .stat element."
I did try to wrap a strong element in my <span class="stat">XP:</span> , but, same error.

My code so far:

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    <title>RPG - Dragon Repeller</title>
    <script src="./script.js"></script>
  </head>
  <body>

<!-- User Editable Region -->

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

<!-- User Editable Region -->

      </div>
      <div id="controls"></div>
      <div id="monsterStats"></div>
      <div id="text"></div>
    </div>
  </body>
</html>
/* file: script.js */
let xp = 0;
let health = 100;
let gold = 50;
let currentWeapon = 0;
let fighting;
let monsterHealth;
let inventory = ["stick"];

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 OPR/106.0.0.0

Challenge Information:

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

Welcome to the forum @karinac.telles

Please reset the step to restore the original code.

Then start nesting the elements around the numbers.

First nest the number in a span element.
Then nest that span element in a strong element.

Happy coding

1 Like

I didn’t know I could put a “span” tag inside another. So, for anyone who had the same problem, check it out:

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

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