2.2 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 62a115879a6d51422652cbfc | Step 11 | 0 | step-11 |
--description--
In your role playing game, users will be able to track their stats, buy weapons, and fight monsters. Before you can continue with the interactive JavaScript portion of the game, you need to first create the HTML elements that will display the game information.
Erstelle vier div-Elemente innerhalb deines #game-Elements. Gib ihnen die folgenden respektiven id-Werte in Reihenfolge: stats, controls, monsterStats und text.
--hints--
Du solltest vier neue div-Elemente erstellen.
assert.equal(document.querySelectorAll('div')?.length, 5);
Du solltest einem der neuen div-Elemente eine id von stats geben.
assert.exists(document.querySelector('div#stats'));
Du solltest einem der neuen div-Elemente eine id von controls geben.
assert.exists(document.querySelector('div#controls'));
Du solltest einem der neuen div-Elemente eine id von monsterStats geben.
assert.exists(document.querySelector('div#monsterStats'));
Du solltest einem der neuen div-Elemente eine id von text geben.
assert.exists(document.querySelector('div#text'));
Du solltest die neuen div-Elemente in der richtigen Reihenfolge platzieren.
function __t(a, b) {
return document.querySelector(a)?.nextElementSibling?.getAttribute('id') === b;
}
assert(__t('div#stats','controls') && __t('div#controls','monsterStats') && __t('div#monsterStats','text'));
Du solltest die neuen div-Elemente innerhalb des #game-Elements platzieren.
assert.equal(document.querySelector('#game')?.children?.length, 4);
--seed--
--seed-contents--
<!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>
--fcc-editable-region--
<body>
<div id="game">
</div>
</body>
--fcc-editable-region--
</html>
let xp = 0;
let health = 100;
let gold = 50;
let currentWeaponIndex = 0;
let fighting;
let monsterHealth;
let inventory = ["stick"];