mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-22 11:36:11 -05:00
81 lines
1.3 KiB
Markdown
81 lines
1.3 KiB
Markdown
---
|
|
id: 62a3a75d8466a12e009eff76
|
|
title: Step 7
|
|
challengeType: 0
|
|
dashedName: step-7
|
|
---
|
|
|
|
# --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--
|
|
```
|