mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-08 09:00:38 -04:00
71 lines
1.3 KiB
Markdown
71 lines
1.3 KiB
Markdown
---
|
|
id: 62a3a7e4f1060e2fc5ffb34b
|
|
title: Schritt 9
|
|
challengeType: 0
|
|
dashedName: step-9
|
|
---
|
|
|
|
# --description--
|
|
|
|
Create another variable called `currentWeapon` and set it to `0`.
|
|
|
|
Wenn ein Variablenname aus mehreren Wörtern besteht, ist es in JavaScript üblich, die sogenannte <dfn>camelCase</dfn> zu verwenden. Das erste Wort wird kleingeschrieben und der erste Buchstabe jedes folgenden Wortes wird großgeschrieben.
|
|
|
|
```js
|
|
let thisIsCamelCase;
|
|
```
|
|
|
|
# --hints--
|
|
|
|
You should use `let` to declare a variable called `currentWeapon`.
|
|
|
|
```js
|
|
assert.match(code, /let\s+currentWeapon/i);
|
|
```
|
|
|
|
Du solltest camelCase verwenden, um deine Variable zu benennen.
|
|
|
|
```js
|
|
assert.match(code, /currentWeapon/);
|
|
```
|
|
|
|
Deine `currentWeapon`-Variable sollte auf `0` gesetzt sein.
|
|
|
|
```js
|
|
assert.equal(currentWeapon, 0);
|
|
```
|
|
|
|
Du solltest deine Variable auf `0` initialisieren.
|
|
|
|
```js
|
|
assert.match(code, /let\s+currentWeapon\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--
|
|
```
|