Back to Freecodecamp

Step 7

curriculum/challenges/english/blocks/learn-basic-javascript-by-building-a-role-playing-game/62a3a75d8466a12e009eff76.md

latest1.2 KB
Original Source

--description--

Initialize another variable called health with a value of 100, and a variable called gold with a value of 50.

--hints--

You should use let to declare a variable called health.

js
assert.match(code, /let\s+health/);

You should initialize a variable called health with a value of 100.

js
assert.match(code, /let\s+health\s*=\s*100/);

You should use let to declare a variable called gold.

js
assert.match(code, /let\s+gold/);

You should initialize a variable called gold with a value of 50.

js
assert.match(code, /let\s+gold\s*=\s*50/);

health should have a value of 100.

js
assert.equal(health, 100);

gold should have a value of 50.

js
assert.equal(gold, 50);

xp should still have a value of 0.

js
assert.equal(xp, 0);

--seed--

--seed-contents--

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>
  </body>
</html>
js
--fcc-editable-region--
let xp = 0;
--fcc-editable-region--