this is my code and exacty matching all requirements still showing error why?
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>
</head>
<body>
<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>
<div id="controls">
<button id="button1">Go to store</button>
<button id="button2">Go to cave</button>
<button id="button3">Fight dragon</button>
</div>
<div id="monsterStats">
<span class="stat">Monster Name: <strong><span id="monsterName"></span></strong></span>
<span class="stat">Health: <strong><span id="monsterHealth"></span></strong></span>
</div>
<div id="text">
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
</div>
</div>
<script src="./script.js"></script>
</body>
</html>
Your solution works from my end. Please try one of the following steps to move forward.
Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.
or - Try the step in incognito or private mode.
or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.
or - Ensure your browser is up-to-date or try a different browser.
I tried but it still shows like
// running tests 1. You should use the same
monsterHealth
line you already wrote. 2. You should add to the
weapons[currentWeaponIndex].power
value. 3. You should use
Math.floor()
. 4. You should use
Math.random()
. 5. You should multiply
Math.random()
by the value of
xp
. 6. You should use
Math.floor()
to round the result of
Math.random() * xp
down. 7. You should add
1
to the result of
Math.floor()
. 8. You should add the result of
Math.floor(Math.random() * xp) + 1
to the result of
weapons[currentWeaponIndex].power
. // tests completed // console output Uncaught ReferenceError: weapons is not defined [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined] [ReferenceError: attack is not defined]
When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
my entire code is not shown in the page
it visible on the screen till before one step
from this step the entire code is not visible on screen only the particular part is available on screen