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">
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    <title>RPG - Dragon Repeller</title>
    <script src="./script.js"></script>

<!-- User Editable Region -->

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

<!-- User Editable Region -->

      <div id="controls"></div>
      <div id="monsterStats"></div>
      <div id="text"></div>
/* 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/ Safari/537.36 OPR/

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>