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

Tell us what’s happening:

I am struggling with stage 17, tried going online for help, but I still am not able to pass this stage

Your 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>
    <div id="game">
      <div id="stats">

<!-- User Editable Region -->

        <span class="stat">xp: <strong>0<span id="xpText">xP: 0</span></strong><span>


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

Hi there and welcome to our community!

This is the starting code for Step 17:

<span class="stat">XP: 0</span>
<span class="stat">Health: 100</span>
<span class="stat">Gold: 50</span>

The instructions:

Wrap the numbers 0 , 100 , and 50 in span elements, and wrap those new span elements in strong elements. Then give your new span elements id values of xpText , healthText , and goldText , respectively.

You should be modifying each of the span elements above, but you appear to have removed and replaced them altogether with this:

You’d be best off resetting the lesson and trying again. Then modify each line in turn, following the above instructions carefully for each.

2 Likes

Thanks very much @igorgetmeabrain.

1 Like