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

Tell us what’s happening:

Describe your issue in detail here.

Your 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>
    <div id="game">
      <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>
      <div id="controls">
        <button id="button1">Go to store</button>
        <button id="button2">Go to cave</button>
        <button id="button3">Fight dragon</button>

<!-- User Editable Region -->

      <div id="monsterStats">
        <span class="stat"</span>
        <span class="stat"</span>
        <span class="stat" id="monsterName">Monster Name: </span>
        <span class="stat"  id="monsterHealth">Health: </span>

<!-- User Editable Region -->

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

const button1 = document.querySelector("#button1");
const button2 = document.querySelector("#button2");
const button3 = document.querySelector("#button3");

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 23

1 Like

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello! Welcome to the forum.3
Next time you create a post, remember to explain your issue.

        <span class="stat"</span>
        <span class="stat"</span>

So these two span elements, are not needed. Remove them.
Then your strong element remove that as well. Just leave the .stat which contains text.

Then in your first span element which is this one:
<span class="stat" id="monsterName">Monster Name: </span>
Add a space after the text 'Monster Name: ’ . Thereafter add a strong element opening tag followed by a span element with an id of monsterName . Then close your span element and then your strong element.
Do the same in your second span element but in your inner span element, set the id to monsterHealth

many thanks its work

1 Like