mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-22 11:36:11 -05:00
65 lines
1.0 KiB
Markdown
65 lines
1.0 KiB
Markdown
---
|
|
id: 62a3a7e4f1060e2fc5ffb34b
|
|
title: Step 8
|
|
challengeType: 0
|
|
dashedName: step-8
|
|
---
|
|
|
|
# --description--
|
|
|
|
Create another variable called `currentWeaponIndex` and set it to `0`.
|
|
|
|
# --hints--
|
|
|
|
You should use `let` to declare a variable called `currentWeaponIndex`.
|
|
|
|
```js
|
|
assert.match(code, /let\s+currentWeaponIndex/i);
|
|
```
|
|
|
|
You should use camelCase to name your variable.
|
|
|
|
```js
|
|
assert.match(code, /currentWeaponIndex/);
|
|
```
|
|
|
|
Your `currentWeaponIndex` variable should be set to `0`.
|
|
|
|
```js
|
|
assert.equal(currentWeaponIndex, 0);
|
|
```
|
|
|
|
You should initialize your variable to `0`.
|
|
|
|
```js
|
|
assert.match(code, /let\s+currentWeaponIndex\s*=\s*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;
|
|
let health = 100;
|
|
let gold = 50;
|
|
--fcc-editable-region--
|
|
```
|