mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
chore(i18n,learn): processed translations (#50972)
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-20
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The first step in calculating the median is to ensure the list of numbers is sorted from least to greatest. Auch hierfür gibt es eine ideale Array-Methode - die `.sort()`-Methode.
|
Der erste Schritt zur Berechnung des Medians besteht darin, die Liste der Zahlen vom kleinsten zum größten Wert zu sortieren. Auch hierfür gibt es eine ideale Array-Methode - die `.sort()`-Methode.
|
||||||
|
|
||||||
Deklariere eine `sorted`-Variable und weise ihr `array.sort()` zu.
|
Deklariere eine `sorted`-Variable und weise ihr `array.sort()` zu.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 6352e80e024e89111600edfb
|
id: 6352e80e024e89111600edfb
|
||||||
title: Step 25
|
title: Schritt 25
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-25
|
dashedName: step-25
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-16
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For debugging purposes, add a `console.log()` call in your inner loop. Weise ihm die Argumente `array`, `array[j]` und `array[j+1]` zu.
|
Füge zu Debugging-Zwecken einen `console.log()`-Aufruf in deine innere Schleife ein. Weise ihm die Argumente `array`, `array[j]` und `array[j+1]` zu.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a115879a6d51422652cbfc
|
id: 62a115879a6d51422652cbfc
|
||||||
title: Step 2
|
title: Schritt 2
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-2
|
dashedName: step-2
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-4
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Wrap the numbers `0`, `100`, and `50` in `span` elements, and wrap those new `span` elements in `strong` elements. Then give your new `span` elements `id` values of `xpText`, `healthText`, and `goldText`, respectively.
|
Wrap the numbers `0`, `100`, and `50` in `span` elements, and wrap those new `span` elements in `strong` elements. Gib dann deinen neuen `span`-Elementen `id`-Werte von `xpText`, `healthText` bzw. `goldText`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ const span = strong?.querySelector('span');
|
|||||||
assert.exists(span);
|
assert.exists(span);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your first nested `span` element should have the `id` of `xpText`.
|
Dein erstes eingebettetes `span`-Element sollte die `id` von `xpText` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const stat = document.querySelectorAll('.stat')[0];
|
const stat = document.querySelectorAll('.stat')[0];
|
||||||
|
|||||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-5
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For your `#controls` element, create three `button` elements. Das erste sollte die `id` auf `button1` gesetzt haben und den Text `Go to store` enthalten. Das zweite sollte die `id` auf `button2` gesetzt haben und den Text `Go to cave` enthalten. Das dritte sollte die `id` auf `button3` gesetzt haben und den Text `Fight dragon` enthalten.
|
Erstelle für dein `#controls`-Element drei `button`-Elemente. Das erste sollte die `id` auf `button1` gesetzt haben und den Text `Go to store` enthalten. Das zweite sollte die `id` auf `button2` gesetzt haben und den Text `Go to cave` enthalten. Das dritte sollte die `id` auf `button3` gesetzt haben und den Text `Fight dragon` enthalten.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should add three `button` elements to your `#controls` element.
|
Du solltest drei `button`-Elemente zu deinem `#controls`-Element hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const buttons = document.querySelectorAll('#controls > button');
|
const buttons = document.querySelectorAll('#controls > button');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a2401b9842721796b72850
|
id: 62a2401b9842721796b72850
|
||||||
title: Step 7
|
title: Schritt 7
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-7
|
dashedName: step-7
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a24068d60b671847d1d4e2
|
id: 62a24068d60b671847d1d4e2
|
||||||
title: Step 8
|
title: Schritt 8
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-8
|
dashedName: step-8
|
||||||
---
|
---
|
||||||
@@ -18,7 +18,7 @@ const body = new __helpers.CSSHelp(document).getStyle('body');
|
|||||||
assert.exists(body);
|
assert.exists(body);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `body` selector should have a `background-color` property set to `darkblue`.
|
Dein `body`-Selektor sollte eine `background-color`-Eigenschaft auf `darkblue` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const background = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('background-color');
|
const background = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('background-color');
|
||||||
|
|||||||
+6
-6
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a240c67f3dbb1a1e6d95ee
|
id: 62a240c67f3dbb1a1e6d95ee
|
||||||
title: Step 10
|
title: Schritt 10
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-10
|
dashedName: step-10
|
||||||
---
|
---
|
||||||
@@ -11,21 +11,21 @@ Gib deinem `#game` eine maximale Breite von `500px` und eine maximale Höhe von
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should have a `#game` selector.
|
Du solltest einen `#game`-Selektor haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const game = new __helpers.CSSHelp(document).getStyle('#game');
|
const game = new __helpers.CSSHelp(document).getStyle('#game');
|
||||||
assert.exists(game);
|
assert.exists(game);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `#game` selector should have a `max-width` of `500px`.
|
Dein `#game`-Selektor sollte eine `max-width` von `500px` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const maxWidth = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('max-width');
|
const maxWidth = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('max-width');
|
||||||
assert.equal(maxWidth, '500px');
|
assert.equal(maxWidth, '500px');
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `#game` selector should have a `max-height` of `400px`.
|
Dein `#game`-Selektor sollte eine `max-height` von `400px` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const maxHeight = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('max-height');
|
const maxHeight = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('max-height');
|
||||||
@@ -46,14 +46,14 @@ const color = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValu
|
|||||||
assert.equal(color, 'white');
|
assert.equal(color, 'white');
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `#game` selector should have a `margin` set to `0 auto`.
|
Dein `#game`-Selektor sollte eine `margin` auf `0 auto` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const margin = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('margin');
|
const margin = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('margin');
|
||||||
assert.equal(margin, '0px auto');
|
assert.equal(margin, '0px auto');
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `#game` selector should have `10px` of padding on all sides.
|
Dein `#game`-Selektor sollte `10px`-Padding auf allen Seiten haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const padding = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('padding');
|
const padding = new __helpers.CSSHelp(document).getStyle('#game')?.getPropertyValue('padding');
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-14
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Finally, give your `.stat` elements a `padding-right` of `10px`.
|
Zum Schluss gibst du deinem `.stat`-Element einen `padding-right` von `10px`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ const stat = new __helpers.CSSHelp(document).getStyle('.stat');
|
|||||||
assert.exists(stat);
|
assert.exists(stat);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `.stat` selector should have a `padding-right` of `10px`.
|
Dein `.stat`-Selektor sollte einen `padding-right` von `10px` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const paddingRight = new __helpers.CSSHelp(document).getStyle('.stat')?.getPropertyValue('padding-right');
|
const paddingRight = new __helpers.CSSHelp(document).getStyle('.stat')?.getPropertyValue('padding-right');
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Beachte, dass die Zeile mit einem Semikolon endet. In JavaScript ist es üblich,
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should add a `console.log("Hello World");` line to your code. Vergesse das Semikolon nicht.
|
Du solltest eine `console.log("Hello World");`-Zeile in deinen Code einfügen. Vergesse das Semikolon nicht.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /console\.log\("Hello World"\);/);
|
assert.match(code, /console\.log\("Hello World"\);/);
|
||||||
|
|||||||
+2
-2
@@ -15,11 +15,11 @@ In JavaScript wird eine <dfn>variable</dfn> verwendet, um einen Wert zu halten.
|
|||||||
var camperbot;
|
var camperbot;
|
||||||
```
|
```
|
||||||
|
|
||||||
The `var` keyword tells JavaScript you are declaring a variable. Deklariere eine Variable namens `xp`.
|
Das `var`-Schlüsselwort gibt JavaScript an, dass du eine Variable deklarierst. Deklariere eine Variable namens `xp`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should not have a `console.log("Hello World");` line in your code.
|
Du solltest keine `console.log("Hello World");`-Zeile in deinem Code haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.notMatch(code, /console\.log\("Hello World"\);/);
|
assert.notMatch(code, /console\.log\("Hello World"\);/);
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ Du solltest camelCase verwenden, um deine Variable zu benennen.
|
|||||||
assert.match(code, /currentWeapon/);
|
assert.match(code, /currentWeapon/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `currentWeapon` variable should be set to `0`.
|
Deine `currentWeapon`-Variable sollte auf `0` gesetzt sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(currentWeapon, 0);
|
assert.equal(currentWeapon, 0);
|
||||||
|
|||||||
+4
-4
@@ -17,7 +17,7 @@ Du solltest `let` verwenden, um deine `monsterHealth` Variable zu deklarieren.
|
|||||||
assert.match(code, /let monsterHealth/i);
|
assert.match(code, /let monsterHealth/i);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use camelCase to name your `monsterHealth` variable.
|
Du solltest camelCase verwenden, um deine `monsterHealth`-Variable zu benennen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /monsterHealth/);
|
assert.match(code, /monsterHealth/);
|
||||||
@@ -29,13 +29,13 @@ assert.match(code, /monsterHealth/);
|
|||||||
assert.isUndefined(monsterHealth);
|
assert.isUndefined(monsterHealth);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should not assign a value to your `monsterHealth` variable. Denke an dein Semikolon.
|
Du solltest deiner `monsterHealth`-Variablen keinen Wert zuweisen. Denke an dein Semikolon.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /let monsterHealth;/);
|
assert.match(code, /let monsterHealth;/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use `let` to declare your `inventory` variable.
|
Du solltest `let` verwenden, um deine `inventory`-Variable zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /let inventory/i);
|
assert.match(code, /let inventory/i);
|
||||||
@@ -47,7 +47,7 @@ assert.match(code, /let inventory/i);
|
|||||||
assert.isUndefined(inventory);
|
assert.isUndefined(inventory);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should not assign a value to your `inventory` variable. Denke an dein Semikolon.
|
Du solltest deiner `inventory`-Variablen keinen Wert zuweisen. Denke an dein Semikolon.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /let inventory;/);
|
assert.match(code, /let inventory;/);
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-26
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Die Variablen, die du zugewiesen hast, hatten alle Werte, die Zahlen sind. JavaScript hat mehrere verschiedene Datentypen. Das nächste Element, das du verwenden wirst, ist der <dfn>String</dfn>. Strings werden verwendet, um Dinge wie Wörter oder Text zu speichern. Zeichenketten werden mit doppelten Anführungszeichen, einfachen Anführungszeichen oder Backticks umgeben. Here is an example of declaring a variable with a string:
|
Die Variablen, die du zugewiesen hast, hatten alle Werte, die Zahlen sind. JavaScript hat mehrere verschiedene Datentypen. Das nächste Element, das du verwenden wirst, ist der <dfn>String</dfn>. Strings werden verwendet, um Dinge wie Wörter oder Text zu speichern. Zeichenketten werden mit doppelten Anführungszeichen, einfachen Anführungszeichen oder Backticks umgeben. Hier ist ein Beispiel für die Deklaration einer Variablen mit einem String:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let developer = "Naomi";
|
let developer = "Naomi";
|
||||||
@@ -23,7 +23,7 @@ Du solltest `inventory` auf die Zeichenfolge `stick` setzen.
|
|||||||
assert.equal(inventory, "stick");
|
assert.equal(inventory, "stick");
|
||||||
```
|
```
|
||||||
|
|
||||||
You should initialize your `inventory` variable with the string `stick`.
|
Du solltest deine `inventory`-Variable mit dem String `stick` initialisieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /let\s+inventory\s*=\s*('|"|`)stick\1/);
|
assert.match(code, /let\s+inventory\s*=\s*('|"|`)stick\1/);
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ dashedName: step-29
|
|||||||
|
|
||||||
JavaScript interagiert mit HTML über das <dfn>Document Object Model</dfn>, oder DOM. Das DOM ist ein Baum von Objekten, der den HTML-Code darstellt. Du kannst auf den HTML-Code über das `document`-Objekt zugreifen, das dein gesamtes HTML-Dokument darstellt.
|
JavaScript interagiert mit HTML über das <dfn>Document Object Model</dfn>, oder DOM. Das DOM ist ein Baum von Objekten, der den HTML-Code darstellt. Du kannst auf den HTML-Code über das `document`-Objekt zugreifen, das dein gesamtes HTML-Dokument darstellt.
|
||||||
|
|
||||||
Eine Methode, um bestimmte Elemente in deinem HTML zu finden, ist die Methode `querySelector()`. The `querySelector()` method takes a CSS selector as an argument and returns the first element that matches that selector. Um zum Beispiel das `<h1>`-Element in deiner HTML zu finden, würdest du schreiben:
|
Eine Methode, um bestimmte Elemente in deinem HTML zu finden, ist die Methode `querySelector()`. Die `querySelector()`-Methode nimmt einen CSS-Selektor als Argument und gibt das erste Element zurück, das mit diesem Selektor übereinstimmt. Um zum Beispiel das `<h1>`-Element in deiner HTML zu finden, würdest du schreiben:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let h1 = document.querySelector("h1");
|
let h1 = document.querySelector("h1");
|
||||||
|
|||||||
+3
-3
@@ -9,17 +9,17 @@ dashedName: step-31
|
|||||||
|
|
||||||
`button1` ist eine Variable, die nicht neu zugewiesen wird. If you are not going to assign a new value to a variable, it is best practice to use the `const` keyword to declare it instead of the `let` keyword. Dadurch wird JavaScript angewiesen, einen Fehler zu melden, wenn du sie versehentlich neu zuweist.
|
`button1` ist eine Variable, die nicht neu zugewiesen wird. If you are not going to assign a new value to a variable, it is best practice to use the `const` keyword to declare it instead of the `let` keyword. Dadurch wird JavaScript angewiesen, einen Fehler zu melden, wenn du sie versehentlich neu zuweist.
|
||||||
|
|
||||||
Change your `button1` variable to be declared with the `const` keyword.
|
Ändere deine `button1`-Variable, so dass sie mit dem `const`-Schlüsselwort deklariert wird.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `button1` variable should be declared with `const`.
|
Deine `button1`-Variable sollte mit `const` deklariert werden.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /const button1/);
|
assert.match(code, /const button1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button1` variable should still have the value of your `#button1` element.
|
Deine `button1`-Variable sollte noch immer den Wert deines `#button1`-Elements haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(button1, document.querySelector("#button1"));
|
assert.deepEqual(button1, document.querySelector("#button1"));
|
||||||
|
|||||||
+5
-5
@@ -11,7 +11,7 @@ Just like you did with the buttons, create variables for the following `id`s and
|
|||||||
|
|
||||||
`text`, `xpText`, `healthText`, `goldText`, `monsterStats` und `monsterName`.
|
`text`, `xpText`, `healthText`, `goldText`, `monsterStats` und `monsterName`.
|
||||||
|
|
||||||
Remember to declare these with the `const` keyword, and name the variables to match the `id`s.
|
Denke daran diese mit dem `const`-Schlüsselwort zu deklarieren und die Variablen so zu benennen, dass sie mit den `id`'s übereinstimmen.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ Du solltest eine `text`-Variable mit `const` deklarieren.
|
|||||||
assert.match(code, /const text/);
|
assert.match(code, /const text/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `text` variable should have the value of your `#text` element.
|
Deine `text`-Variable sollte den Wert deines `#text`-Elements haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(text, document.querySelector('#text'));
|
assert.deepEqual(text, document.querySelector('#text'));
|
||||||
@@ -33,7 +33,7 @@ Du solltest mit `const` eine `xpText`-Variable deklarieren.
|
|||||||
assert.match(code, /const xpText/);
|
assert.match(code, /const xpText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `xpText` variable should have the value of your `#xpText` element.
|
Deine `xpText`-Variable sollte den Wert deines `#xpText`-Elements haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(xpText, document.querySelector('#xpText'));
|
assert.deepEqual(xpText, document.querySelector('#xpText'));
|
||||||
@@ -69,7 +69,7 @@ Du solltest eine `monsterStats`-Variable mit `const` deklarieren.
|
|||||||
assert.match(code, /const monsterStats/);
|
assert.match(code, /const monsterStats/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `monsterStats` variable should have the value of your `#monsterStats` element.
|
Deine `monsterStats`-Variable sollte den Wert deines `#monsterStats`-Elements haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(monsterStats, document.querySelector('#monsterStats'));
|
assert.deepEqual(monsterStats, document.querySelector('#monsterStats'));
|
||||||
@@ -81,7 +81,7 @@ Du solltest eine `monsterName`-Variable mit `const` deklarieren.
|
|||||||
assert.match(code, /const monsterName/);
|
assert.match(code, /const monsterName/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `monsterName` variable should have the value of your `#monsterName` element.
|
Deine `monsterName`-Variable sollte den Wert deines `#monsterName`-Elements haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(monsterName, document.querySelector('#monsterName'));
|
assert.deepEqual(monsterName, document.querySelector('#monsterName'));
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-37
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Using the same syntax, set the `onclick` properties of `button2` and `button3` to `goCave` and `fightDragon` respectively.
|
Setze mit der gleichen Syntax die `onclick`-Eigenschaften von `button2` und `button3` auf `goCave` bzw. auf `fightDragon`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ Erstelle eine leere Funktion namens `goStore`. Dies entspricht der Variablen `go
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should declare `goStore` with the `function` keyword.
|
Du solltest `goStore` mit dem `function`-Schlüsselwort deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s*goStore()/);
|
assert.match(code, /function\s*goStore()/);
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ assert.match(code, /function goCave/);
|
|||||||
assert.isFunction(goCave);
|
assert.isFunction(goCave);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should have a `console.log("Going to cave.");` line in your code.
|
Du solltest eine `console.log("Going to cave.");`-Zeile in deinem Code haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /console.log\(('|")Going to cave\.\1\)/);
|
assert.match(code, /console.log\(('|")Going to cave\.\1\)/);
|
||||||
|
|||||||
+3
-3
@@ -7,13 +7,13 @@ dashedName: step-41
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Now create a `fightDragon` function that prints `Fighting dragon.` to the console.
|
Erstelle nun eine `fightDragon`-Funktion, die `Fighting dragon.` auf die Konsole druckt.
|
||||||
|
|
||||||
Öffne anschließend Ihre Konsole und versuche die Schaltflächen deines Projekts anzuklicken.
|
Öffne anschließend Ihre Konsole und versuche die Schaltflächen deines Projekts anzuklicken.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare `fightDragon`.
|
Du solltest mit dem `function`-Schlüsselwort `fightDragon` deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function fightDragon/);
|
assert.match(code, /function fightDragon/);
|
||||||
@@ -31,7 +31,7 @@ Du solltest eine `console.log("Fighting dragon.");` Zeile in deinem Code haben.
|
|||||||
assert.match(code, /console.log\(('|")Fighting dragon\.\1\)/);
|
assert.match(code, /console.log\(('|")Fighting dragon\.\1\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `console.log("Fighting dragon.");` line should be inside your `fightDragon` function.
|
Deine `console.log("Fighting dragon.");`-Zeile sollte sich in deiner `fightDragon`-Funktion befinden.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(fightDragon.toString(), /console.log\(('|")Fighting dragon\.\1\)/);
|
assert.match(fightDragon.toString(), /console.log\(('|")Fighting dragon\.\1\)/);
|
||||||
|
|||||||
+5
-5
@@ -7,7 +7,7 @@ dashedName: step-42
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The `innerText` property controls the text that appears in an HTML element. Zum Beispiel:
|
Die `innerText`-Eigenschaft steuert den Text, der in einem HTML-Element angezeigt wird. Zum Beispiel:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const info = document.querySelector("#info");
|
const info = document.querySelector("#info");
|
||||||
@@ -20,25 +20,25 @@ Wenn ein Spieler auf die Schaltfläche `Go to store` klickt, möchtest du die Sc
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should not have a `console.log("Going to store.");` line in your code.
|
Du solltest keine `console.log("Going to store.");`-Zeile in deinem Code haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.notMatch(code, /console.log\(('|")Going to store\.\1\)/);
|
assert.notMatch(code, /console.log\(('|")Going to store\.\1\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use dot notation to access the `innerText` property of `button1`.
|
Du solltest die Punktnotation verwenden, um auf die `innerText`-Eigenschaft von `button1` zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /button1\.innerText/);
|
assert.match(code, /button1\.innerText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should not use `let` or `const` to access the `innerText` property of `button1`.
|
Du solltest `let` oder `const` verwenden, um auf die `innerText`-Eigenschaft von `button1` zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.notMatch(code, /(let|const)\s+button1.innerText/);
|
assert.notMatch(code, /(let|const)\s+button1.innerText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should update the `innerText` property of `button1` to be `Buy 10 health (10 gold)`.
|
Du solltest die `innerText`-Eigenschaft von `button1` so aktualisieren, dass sie `Buy 10 health (10 gold)` ergibt.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /button1\.innerText\s*=\s*('|")Buy 10 health \(10 gold\)\1/);
|
assert.match(code, /button1\.innerText\s*=\s*('|")Buy 10 health \(10 gold\)\1/);
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ You should not use `let` or `const` to access the `innerText` property of `butto
|
|||||||
assert.notMatch(code, /(let|const)\s+button2.innerText/);
|
assert.notMatch(code, /(let|const)\s+button2.innerText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should update the `innerText` property of `button2` to be `Buy weapon (30 gold)`.
|
Du solltest die `innerText`-Eigenschaft von `button2` so aktualisieren, dass sie `Buy weapon (30 gold)` ergibt.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /button2\.innerText\s*=\s*('|")Buy weapon \(30 gold\)\1/);
|
assert.match(code, /button2\.innerText\s*=\s*('|")Buy weapon \(30 gold\)\1/);
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ Du solltest die `onclick`-Eigenschaft von `button1` auf `buyHealth` setzen.
|
|||||||
assert.match(code, /button1\.onclick\s*=\s*buyHealth/);
|
assert.match(code, /button1\.onclick\s*=\s*buyHealth/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set the `onclick` property of `button1` in your `goStore` function.
|
Du solltest die `onclick`-Eigenschaft von `button1` in deiner `goStore`-Funktion festlegen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goStore.toString(), /button1\.onclick\s*=\s*buyHealth/);
|
assert.match(goStore.toString(), /button1\.onclick\s*=\s*buyHealth/);
|
||||||
|
|||||||
+3
-3
@@ -11,19 +11,19 @@ Erstelle drei neue leere Funktionen namens `buyHealth`, `buyWeapon` und `goTown`
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should declare `buyHealth` with the `function` keyword.
|
Du solltest `buyHealth` mit dem `function`-Schlüsselwort deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function buyHealth/);
|
assert.match(code, /function buyHealth/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should declare `buyWeapon` with the `function` keyword.
|
Du solltest `buyWeapon` mit dem `function`-Schlüsselwort deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function buyWeapon/);
|
assert.match(code, /function buyWeapon/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should declare `goTown` with the `function` keyword.
|
Du solltest `goTown` mit dem `function`-Schlüsselwort deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function goTown/);
|
assert.match(code, /function goTown/);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a7c071219da921758a35bb
|
id: 62a7c071219da921758a35bb
|
||||||
title: Step 48
|
title: Schritt 48
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-48
|
dashedName: step-48
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-52
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
You previously used an array to store strings. Arrays können jedoch beliebige Datentypen speichern. Diesmal wird deine Anordnung Objekte speichern. Objekte sind ähnlich wie Anordnungen, allerdings mit einigen Unterschieden. Ein Unterschied besteht darin, dass Objekte Eigenschaften oder Schlüssel verwenden, um auf Daten zuzugreifen und sie zu ändern.
|
Du hast zuvor ein Array zum Speichern von Strings verwendet. Arrays können jedoch beliebige Datentypen speichern. Diesmal wird deine Anordnung Objekte speichern. Objekte sind ähnlich wie Anordnungen, allerdings mit einigen Unterschieden. Ein Unterschied besteht darin, dass Objekte Eigenschaften oder Schlüssel verwenden, um auf Daten zuzugreifen und sie zu ändern.
|
||||||
|
|
||||||
Objekte sind durch geschweifte Klammern gekennzeichnet. Ein leeres Objekt würde wie `{}` aussehen.
|
Objekte sind durch geschweifte Klammern gekennzeichnet. Ein leeres Objekt würde wie `{}` aussehen.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ Object <dfn>properties</dfn> are written as `key: value` pairs, where `key` is t
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Add a `name` property to your empty object and give it a value of `town square`.
|
Füge eine `name`-Eigenschaft zu deinem leeren Objekt hinzu und gib ihm einen Wert von `town square`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ Dein erster Wert von `locations` sollte ein Objekt sein.
|
|||||||
assert.isObject(locations[0]);
|
assert.isObject(locations[0]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your first value of `locations` should have a `name` property.
|
Dein erster Wert von `locations` sollte eine `name`-Eigenschaft haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isDefined(locations[0].name);
|
assert.isDefined(locations[0].name);
|
||||||
|
|||||||
+5
-5
@@ -7,17 +7,17 @@ dashedName: step-55
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Give your empty `button text` array three string elements. Use the three strings being assigned to the button `innerText` properties in the `goTown` function. Denke daran, dass Arraywerte durch Kommas getrennt werden.
|
Gib deinem leeren `button text`-Array drei String-Elemente. Use the three strings being assigned to the button `innerText` properties in the `goTown` function. Denke daran, dass Arraywerte durch Kommas getrennt werden.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `button text` array should have three elements.
|
Dein `button text`-Array sollte drei Elemente haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.lengthOf(locations[0]["button text"], 3);
|
assert.lengthOf(locations[0]["button text"], 3);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button text` array should have three strings.
|
Dein `button text`-Array sollte drei Strings haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isString(locations[0]["button text"][0]);
|
assert.isString(locations[0]["button text"][0]);
|
||||||
@@ -25,13 +25,13 @@ assert.isString(locations[0]["button text"][1]);
|
|||||||
assert.isString(locations[0]["button text"][2]);
|
assert.isString(locations[0]["button text"][2]);
|
||||||
```
|
```
|
||||||
|
|
||||||
The first value in the `button text` array should be "Go to store".
|
Der erste Wert im `button text`-Array sollte "Go to store" sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[0]["button text"][0], "Go to store");
|
assert.equal(locations[0]["button text"][0], "Go to store");
|
||||||
```
|
```
|
||||||
|
|
||||||
The second value in the `button text` array should be "Go to cave".
|
Der zweite Wert im `button text`-Array sollte "Go to cave" sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[0]["button text"][1], "Go to cave");
|
assert.equal(locations[0]["button text"][1], "Go to cave");
|
||||||
|
|||||||
+7
-7
@@ -7,41 +7,41 @@ dashedName: step-56
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Erstelle in deinem Objekt eine weitere Eigenschaft namens `button functions`. Give this property an array containing the three functions assigned to the `onclick` properties in the `goTown` function. Denke daran, dass diese Funktionen Variablen und keine Zeichenketten sind und, dass sie nicht zwischen Anführungzeichen stehen sollten.
|
Erstelle in deinem Objekt eine weitere Eigenschaft namens `button functions`. Gib dieser Eigenschaft ein Array, das die drei Funktionen enthält, die den `onclick`-Eigenschaften in der `goTown`-Funktion zugewiesen wurden. Denke daran, dass diese Funktionen Variablen und keine Zeichenketten sind und, dass sie nicht zwischen Anführungzeichen stehen sollten.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your first `locations` object should have a `button functions` property.
|
Dein erstes `locations`-Objekt sollte eine `button functions`-Eigenschaft haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isDefined(locations[0]["button functions"]);
|
assert.isDefined(locations[0]["button functions"]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button functions` property should be an array.
|
Deine `button functions`-Eigenschaft sollte ein Array sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isArray(locations[0]["button functions"]);
|
assert.isArray(locations[0]["button functions"]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button functions` property should have three values in it.
|
Deine `button functions`-Eigenschaft sollte drei Werte enthalten.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.lengthOf(locations[0]["button functions"], 3);
|
assert.lengthOf(locations[0]["button functions"], 3);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your first `button functions` array value should be the function `goStore`.
|
Dein erster `button functions`-Arraywert sollte die Funktion `goStore` sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[0]["button functions"][0], goStore);
|
assert.equal(locations[0]["button functions"][0], goStore);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your second `button functions` array value should be the function `goCave`.
|
Dein zweiter `button functions`-Arraywert sollte die Funktion `goCave` sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[0]["button functions"][1], goCave);
|
assert.equal(locations[0]["button functions"][1], goCave);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `button functions` array value should be the function `fightDragon`.
|
Dein dritter `button functions`-Arraywert sollte die Funktion `fightDragon` sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[0]["button functions"][2], fightDragon);
|
assert.equal(locations[0]["button functions"][2], fightDragon);
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ Füge dem Objekt eine letzte Eigenschaft namens `text` hinzu. Gebe dieser Eigens
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your first `locations` value should have a `text` property.
|
Dein erster `locations`-Wert sollte eine `text`-Eigenschaft haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isDefined(locations[0]["text"]);
|
assert.isDefined(locations[0]["text"]);
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ Your second `locations` object should have a `text` property which is a string.
|
|||||||
assert.isString(locations[1].text);
|
assert.isString(locations[1].text);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your second `locations` object should have a `text` property with the value of `You enter the store.`.
|
Dein zweites `locations`-Objekt sollte eine `text`-Eigenschaft mit dem Wert `You enter the store.` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[1].text, "You enter the store.");
|
assert.equal(locations[1].text, "You enter the store.");
|
||||||
|
|||||||
+3
-3
@@ -7,17 +7,17 @@ dashedName: step-61
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
You now need to pass the `location` argument into the `update` call. Du übergibst Argumente, indem du sie zwischen den Klammern des Funktionsaufrufs einfügst. Zum Beispiel würde der Aufruf von `myFunction` mit einem `arg`-Argument wie folgt aussehen:
|
Du musst nun das Argument `location` an den `update`-Aufruf übergeben. Du übergibst Argumente, indem du sie zwischen den Klammern des Funktionsaufrufs einfügst. Zum Beispiel würde der Aufruf von `myFunction` mit einem `arg`-Argument wie folgt aussehen:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
myFunction(arg)
|
myFunction(arg)
|
||||||
```
|
```
|
||||||
|
|
||||||
Pass your `locations` array into the `update` call.
|
Übergib dein `locations`-Array an den `update`-Aufruf weiter.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should pass the `locations` array into the `update` call.
|
Du solltest das `locations`-Array an den `update`-Aufruf übergeben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goTown.toString(), /update\(locations\);/);
|
assert.match(goTown.toString(), /update\(locations\);/);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Du solltest auf das erste Element der `button text`-Eigenschaft des `location`-A
|
|||||||
assert.match(update.toString(), /location\[('|")button text\1\]\[0\]/);
|
assert.match(update.toString(), /location\[('|")button text\1\]\[0\]/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set the `button1.innerText` property to be the first element of the `button text` property of the `location` argument.
|
Du solltest die Eigenschaft `button1.innerText` so einstellen, dass sie das erste Element der `button text`-Eigenschaft des `location`-Arguments ist.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(update.toString(), /button1\.innerText\s*=\s*location\[('|")button text\1\]\[0\]/);
|
assert.match(update.toString(), /button1\.innerText\s*=\s*location\[('|")button text\1\]\[0\]/);
|
||||||
|
|||||||
+4
-4
@@ -7,11 +7,11 @@ dashedName: step-66
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Following the same pattern as you did for the button text, update the three buttons' `onclick` assignments to be the first, second, and third values of the `button functions` array.
|
Aktualisiere die `onclick`-Zuweisungen der drei Schaltflächen nach demselben Muster wie für den Schaltflächentext, sodass sie den ersten, zweiten und dritten Wert der `button functions`-Arrays darstellen.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should access the first element of the `button functions` property of the `location` argument.
|
Du solltest auf das erste Element der `button functions`-Eigenschaft des `location`-Arguments zugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(update.toString(), /location\[('|")button functions\1\]\[0\]/);
|
assert.match(update.toString(), /location\[('|")button functions\1\]\[0\]/);
|
||||||
@@ -23,7 +23,7 @@ Du solltest die `button1.onclick`-Eigenschaft so einstellen, dass sie das erste
|
|||||||
assert.match(update.toString(), /button1\.onclick\s*=\s*location\[('|")button functions\1\]\[0\]/);
|
assert.match(update.toString(), /button1\.onclick\s*=\s*location\[('|")button functions\1\]\[0\]/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should access the second element of the `button functions` property of the `location` argument.
|
Du solltest auf das zweite Element der `button functions`-Eigenschaft des `location`-Arguments zugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(update.toString(), /location\[('|")button functions\1\]\[1\]/);
|
assert.match(update.toString(), /location\[('|")button functions\1\]\[1\]/);
|
||||||
@@ -35,7 +35,7 @@ Du solltest die `button2.onclick`-Eigenschaft so einstellen, dass sie das zweite
|
|||||||
assert.match(update.toString(), /button2\.onclick\s*=\s*location\[('|")button functions\1\]\[1\]/);
|
assert.match(update.toString(), /button2\.onclick\s*=\s*location\[('|")button functions\1\]\[1\]/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should access the third element of the `button functions` property of the `location` argument.
|
Du solltest auf das dritte Element der `button functions`-Eigenschaft des `location`-Arguments zugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(update.toString(), /location\[('|")button functions\1\]\[2\]/);
|
assert.match(update.toString(), /location\[('|")button functions\1\]\[2\]/);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ person.name
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use dot notation to access the `text` property of the `location` object.
|
Du solltest die Punktnotation verwenden, um auf die `text`-Eigenschaft vom `location`-Objekt zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(update.toString(), /location\.text/);
|
assert.match(update.toString(), /location\.text/);
|
||||||
|
|||||||
+8
-8
@@ -9,18 +9,18 @@ dashedName: step-70
|
|||||||
|
|
||||||
Füge ein drittes Objekt zum `locations` Array hinzu. Gib ihm die gleichen Eigenschaften wie den anderen beiden Objekten.
|
Füge ein drittes Objekt zum `locations` Array hinzu. Gib ihm die gleichen Eigenschaften wie den anderen beiden Objekten.
|
||||||
|
|
||||||
Setze `name` auf `cave`. Set `button text` to an array with the strings `Fight slime`, `Fight fanged beast`, and `Go to town square`. Set the `button functions` to an array with the variables `fightSlime`, `fightBeast`, and `goTown`. Set the `text` property to `You enter the cave. You see some monsters.`.
|
Setze `name` auf `cave`. Setze `button text` auf ein Array mit den Strings `Fight slime`, `Fight fanged beast`, und `Go to town square`. Setze die `button functions` auf ein Array mit den Variablen `fightSlime`, `fightBeast`, und `goTown`. Setze die `text`-Eigenschaft auf `You enter the cave. You see some monsters.`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should have three values in your `locations` array.
|
Du solltest drei Werte in deinem `locations`-Array haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
console.log(locations);
|
console.log(locations);
|
||||||
assert.lengthOf(locations, 3);
|
assert.lengthOf(locations, 3);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `locations` value should be an object.
|
Dein dritter `locations`-Wert sollte ein Objekt sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isObject(locations[2]);
|
assert.isObject(locations[2]);
|
||||||
@@ -32,13 +32,13 @@ Your third `locations` object should have a `name` property with the value of `c
|
|||||||
assert.equal(locations[2].name, "cave");
|
assert.equal(locations[2].name, "cave");
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `locations` object should have a `button text` property which is an array.
|
Dein drittes `locations`-Objekt sollte eine `button text`-Eigenschaft haben, welche ein Array ist.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isArray(locations[2]["button text"]);
|
assert.isArray(locations[2]["button text"]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button text` property should have the string values `Fight slime`, `Fight fanged beast`, and `Go to town square`.
|
Deine `button text`-Eigenschaft sollte die Stringwerte `Fight slime`, `Fight fanged beast`, und `Go to town square` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[2]["button text"][0], "Fight slime");
|
assert.equal(locations[2]["button text"][0], "Fight slime");
|
||||||
@@ -46,13 +46,13 @@ assert.equal(locations[2]["button text"][1], "Fight fanged beast");
|
|||||||
assert.equal(locations[2]["button text"][2], "Go to town square");
|
assert.equal(locations[2]["button text"][2], "Go to town square");
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `locations` object should have a `button functions` property which is an array.
|
Dein drittes `locations`-Objekt sollte eine `button functions`-Eigenschaft haben, die ein Array ist.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isArray(locations[2]["button functions"]);
|
assert.isArray(locations[2]["button functions"]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `button functions` property should have the function values `fightSlime`, `fightBeast`, and `goTown`.
|
Deine `button functions`-Eigenschaft sollte die Funktionswerte `fightSlime`, `fightBeast`, und `goTown` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[2]["button functions"][0], fightSlime);
|
assert.equal(locations[2]["button functions"][0], fightSlime);
|
||||||
@@ -66,7 +66,7 @@ Dein drittes `locations`-Objekt sollte eine `text`-Eigenschaft haben, die ein St
|
|||||||
assert.isString(locations[2].text);
|
assert.isString(locations[2].text);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `locations` object should have a `text` property with the value of `You enter the cave. You see some monsters.`.
|
Dein drittes `locations`-Objekt sollte eine `text`-Eigenschaft mit dem Wert `You enter the cave. You see some monsters.` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[2].text, "You enter the cave. You see some monsters.");
|
assert.equal(locations[2].text, "You enter the cave. You see some monsters.");
|
||||||
|
|||||||
+3
-3
@@ -7,13 +7,13 @@ dashedName: step-71
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Da du nun ein `cave`-Ortsobjekt hast, aktualisiere deine `goCave`-Funktion, um `update` aufzurufen und den neuen `cave` Ort zu übergeben. Remember that this is the third element in your `locations` array.
|
Da du nun ein `cave`-Ortsobjekt hast, aktualisiere deine `goCave`-Funktion, um `update` aufzurufen und den neuen `cave` Ort zu übergeben. Denke daran, dass dies das dritte Element in deinem `locations`-Array ist.
|
||||||
|
|
||||||
Vergesse nicht, deinen `console.log`-Aufruf zu entfernen!
|
Vergesse nicht, deinen `console.log`-Aufruf zu entfernen!
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use bracket notation to access the third element in your `locations` array.
|
Du solltest die Klammerschreibweise verwenden, um auf das dritte Element in deinem `locations`-Array zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /locations\[2\]/);
|
assert.match(code, /locations\[2\]/);
|
||||||
@@ -25,7 +25,7 @@ Du solltest das dritte Element in deinem `locations`-Array an `update` übergebe
|
|||||||
assert.match(code, /update\(locations\[2\]\)/);
|
assert.match(code, /update\(locations\[2\]\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should call `update` with the third element in your `locations` array in your `goCave` function.
|
Du solltest `update` mit dem dritten Element in deinem `locations`-Array in deiner `goCave`-Funktion aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goCave.toString(), /update\(locations\[2\]\)/);
|
assert.match(goCave.toString(), /update\(locations\[2\]\)/);
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ Du solltest `10` von `gold` abziehen.
|
|||||||
assert.match(code, /gold\s*=\s*gold\s*-\s*10/);
|
assert.match(code, /gold\s*=\s*gold\s*-\s*10/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `buyHealth` function should reduce `gold` by `10`.
|
Deine `buyHealth`-Funktion sollte `gold` um `10` reduzieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
gold = 10;
|
gold = 10;
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,7 @@ function myFunction() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For now, follow that pattern to use a string `condition` inside your `if` statement.
|
Für den Moment folgst du diesem Muster, um ein String `condition` innerhalb deiner `if`-Anweisung zu verwenden.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -27,13 +27,13 @@ Deine `buyHealth`-Funktion sollte eine `if`-Anweisung haben.
|
|||||||
assert.match(buyHealth.toString(), /if/);
|
assert.match(buyHealth.toString(), /if/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `if` statement should have the string `condition` for the condition.
|
Deine `if`-Anweisung sollte den String `condition` für die Bedingung enthalten.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)/);
|
assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
All of your `buyHealth` code should be inside the `if` statement.
|
Der gesamte Code für `buyHealth` sollte innerhalb der `if`-Anweisung stehen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)\s*\{[\s\S]*\}/);
|
assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)\s*\{[\s\S]*\}/);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Your `buyHealth` function should set `text.innerText` to equal `You do not have
|
|||||||
assert.match(buyHealth.toString(), /text\.innerText\s*=\s*('|")You do not have enough gold to buy health\.\1/);
|
assert.match(buyHealth.toString(), /text\.innerText\s*=\s*('|")You do not have enough gold to buy health\.\1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `buyHealth` function should update `text.innerText` when `gold` is less than `10`.
|
Deine `buyHealth`-Funktion sollte `text.innerText` aktualisieren, wenn `gold` kleiner als `10` ist.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
gold = 5;
|
gold = 5;
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-80
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Use `const` to create a `weapons` variable above your `locations` array. Weise ihm einen leeren Bereich zu.
|
Verwende `const`, um eine `weapons`-Variable über deinem `locations`-Array zu erstellen. Weise ihm einen leeren Bereich zu.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ Du solltest `const` verwenden, um deine `weapons`-Variable zu deklarieren.
|
|||||||
assert.match(code, /const weapons/i);
|
assert.match(code, /const weapons/i);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `weapons` variable should be an array.
|
Deine `weapons`-Variable sollte ein Array sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isArray(weapons);
|
assert.isArray(weapons);
|
||||||
|
|||||||
+5
-5
@@ -7,7 +7,7 @@ dashedName: step-81
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Just like your `locations` array, your `weapons` array will hold objects. Füge dem `weapons`-Array vier Objekte hinzu, jedes mit zwei Eigenschaften: `name` und `power`. Der erste sollte den `name` auf `stick` und die `power` auf `5` gesetzt haben. Der zweite sollte `dagger` und `30` sein. Der dritte, `claw hammer` und `50`. Der vierte, `sword` und `100`.
|
Genau wie dein `locations`-Array wird auch dein `weapons`-Array Objekte enthalten. Füge dem `weapons`-Array vier Objekte hinzu, jedes mit zwei Eigenschaften: `name` und `power`. Der erste sollte den `name` auf `stick` und die `power` auf `5` gesetzt haben. Der zweite sollte `dagger` und `30` sein. Der dritte, `claw hammer` und `50`. Der vierte, `sword` und `100`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -26,28 +26,28 @@ assert.isObject(weapons[2]);
|
|||||||
assert.isObject(weapons[3]);
|
assert.isObject(weapons[3]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your first `weapons` object should have the `name` set to `stick` and the `power` set to `5`.
|
Dein erstes `weapons`-Objekt sollte den `name` auf `stick` und die `power` auf `5` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(weapons[0].name, 'stick');
|
assert.equal(weapons[0].name, 'stick');
|
||||||
assert.equal(weapons[0].power, 5);
|
assert.equal(weapons[0].power, 5);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your second `weapons` object should have the `name` set to `dagger` and the `power` set to `30`.
|
Dein zweites `weapons`-Objekt sollte den `name` auf `dagger` und die `power` auf `30` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(weapons[1].name, 'dagger');
|
assert.equal(weapons[1].name, 'dagger');
|
||||||
assert.equal(weapons[1].power, 30);
|
assert.equal(weapons[1].power, 30);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your third `weapons` object should have the `name` set to `claw hammer` and the `power` set to `50`.
|
Dein drittes `weapons`-Objekt sollte den `name` auf `claw hammer` und die `power` auf `50` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(weapons[2].name, 'claw hammer');
|
assert.equal(weapons[2].name, 'claw hammer');
|
||||||
assert.equal(weapons[2].power, 50);
|
assert.equal(weapons[2].power, 50);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your fourth `weapons` object should have the `name` set to `sword` and the `power` set to `100`.
|
Dein viertes `weapons`-Objekt sollte den `name` auf `sword` und die `power` auf `100` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(weapons[3].name, 'sword');
|
assert.equal(weapons[3].name, 'sword');
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-82
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Inside your `buyWeapon` function, add an `if` statement to check if `gold` is greater than or equal to `30`.
|
Füge in deiner `buyWeapon`-Funktion eine `if`-Anweisung hinzu, um zu überprüfen, ob `gold` größer oder gleich `30` ist.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-83
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Similar to your `buyHealth` function, set `gold` equal to `30` less than its current value. Make sure this is inside your `if` statement.
|
Setze `gold`, ähnlich wie deine `buyHealth`-Funktion auf `30` weniger als seinen aktuellen Wert. Stelle sicher, dass dies innerhalb deiner `if`-Anweisung geschieht.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ You should use compound assignment to subtract `30` from `gold`.
|
|||||||
assert.match(buyWeapon.toString(), /gold\s*-=\s*30/);
|
assert.match(buyWeapon.toString(), /gold\s*-=\s*30/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `buyWeapon` function should reduce `gold` by `30`.
|
Deine `buyWeapon`-Funktion sollte `gold` um `30` reduzieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
gold = 30;
|
gold = 30;
|
||||||
|
|||||||
+3
-3
@@ -7,17 +7,17 @@ dashedName: step-86
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Now update the `goldText` element to display the new value of `gold`, and update the `text` element to display `You now have a new weapon.`.
|
Aktualisiere nun das `goldText`-Element so, dass es den neuen Wert von `gold` anzeigt, und aktualisiere das `text`-Element so, dass es `You now have a new weapon.` anzeigt.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should update the `innerText` property of the `goldText` element to be `gold`.
|
Du solltest die `innerText`-Eigenschaft des `goldText`-Elements so aktualisieren, dass sie `gold` ergibt.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /goldText\.innerText\s*=\s*gold/);
|
assert.match(buyWeapon.toString(), /goldText\.innerText\s*=\s*gold/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should update the `innerText` property of the `text` element to be `You now have a new weapon.`.
|
Du solltest die `innerText`-Eigenschaft des `text`-Elements so aktualisieren, dass sie `You now have a new weapon.` ergibt.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a new weapon\.\1/);
|
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a new weapon\.\1/);
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ Du solltest dem Spieler mitteilen, welche Waffe er gekauft hat. Benutze zwischen
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `buyWeapon` function should have a variable named `newWeapon`.
|
Deine `buyWeapon`-Funktion sollte eine Variable namens `newWeapon` enthalten.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /newWeapon/);
|
assert.match(buyWeapon.toString(), /newWeapon/);
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-89
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
`weapons[currentWeapon]` ist ein Objekt. Use dot notation to get the `name` property of that object.
|
`weapons[currentWeapon]` ist ein Objekt. Verwende die Punktnotation, um die `name`-Eigenschaft des Objekts zu erhalten.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -18,13 +18,13 @@ const ourStr = "Hello, our name is " + ourName + ".";
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should update the `text.innerText` assignment to start with the string `You now have a`.
|
Du solltest die `text.innerText`-Zuweisung aktualisieren, so dass sie mit dem String `You now have a` beginnt.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a \1/);
|
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a \1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the concatenation operator to add `newWeapon` to the end of the `text.innerText` string.
|
Du solltest den Verkettungsoperator verwenden, um `newWeapon` am Ende des `text.innerText` Strings hinzuzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a \1\s*\+\s*newWeapon/);
|
assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a \1\s*\+\s*newWeapon/);
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ dashedName: step-91
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Back at the beginning of this project, you created the `inventory` array. Add the `newWeapon` to the end of the `inventory` array using the `push()` method.
|
Am Anfang dieses Projekts, hast du das `inventory`-Array erstellt. Füge die `newWeapon` am Ende des `inventory`-Arrays hinzu, indem du die `push()`-Methode verwendest.
|
||||||
|
|
||||||
Hier ist ein Beispiel:
|
Hier ist ein Beispiel:
|
||||||
|
|
||||||
@@ -27,13 +27,13 @@ Du solltest die `push` Methode bei der `inventory` verwenden.
|
|||||||
assert.match(buyWeapon.toString(), /inventory\.push/)
|
assert.match(buyWeapon.toString(), /inventory\.push/)
|
||||||
```
|
```
|
||||||
|
|
||||||
You should `push` the value of `newWeapon` to the `inventory` array.
|
Du solltest mit `push` den Wert von `newWeapon` ins `inventory`-Array übertragen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /inventory\.push\s*\(\s*newWeapon\s*\)/)
|
assert.match(buyWeapon.toString(), /inventory\.push\s*\(\s*newWeapon\s*\)/)
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `buyWeapon` function should add the value of `newWeapon` to the `inventory` array.
|
Deine `buyWeapon`-Funktion sollte den Wert der `newWeapon` zum `inventory`-Array hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
inventory = [];
|
inventory = [];
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-92
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Bislang wurde der alte Text jedes Mal gelöscht, sobald `text.innerText` aktualisiert wurde. This time, use the `+=` operator to add text to the end of `text.innerText`.
|
Bislang wurde der alte Text jedes Mal gelöscht, sobald `text.innerText` aktualisiert wurde. Verwende dieses Mal den `+=`-Operator, um am Ende von `text.innerText`-Text hinzuzufügen.
|
||||||
|
|
||||||
Füge den String `In your inventory you have:` hinzu - füge die Leerzeichen am Anfang und am Ende ein.
|
Füge den String `In your inventory you have:` hinzu - füge die Leerzeichen am Anfang und am Ende ein.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a8d08668fa8b38732486e9
|
id: 62a8d08668fa8b38732486e9
|
||||||
title: Step 93
|
title: Schritt 93
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-93
|
dashedName: step-93
|
||||||
---
|
---
|
||||||
|
|||||||
+4
-4
@@ -7,17 +7,17 @@ dashedName: step-94
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Add an `else` statement to your `buyWeapon` function. Setze in diesem Statement `text.innerText` gleich `You do not have enough gold to buy a weapon.`.
|
Füge eine `else`-Anweisung zu deiner `buyWeapon`-Funktion hinzu. Setze in diesem Statement `text.innerText` gleich `You do not have enough gold to buy a weapon.`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should add an `else` statement to your `buyWeapon` function.
|
Du solltest eine `else`-Anweisung zu deiner `buyWeapon`-Funktion hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(buyWeapon.toString(), /else/);
|
assert.match(buyWeapon.toString(), /else/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `else` statement should come after your `if` statement.
|
Deine `else`-Anweisung sollte immer nach deiner `if`-Anweisung kommen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const split = buyWeapon.toString().split(/\s|\n/);
|
const split = buyWeapon.toString().split(/\s|\n/);
|
||||||
@@ -30,7 +30,7 @@ Du solltest `text.innerText` auf `You do not have enough gold to buy a weapon.`
|
|||||||
assert.match(buyWeapon.toString(), /text.innerText\s*=\s*('|")You do not have enough gold to buy a weapon.\1/);
|
assert.match(buyWeapon.toString(), /text.innerText\s*=\s*('|")You do not have enough gold to buy a weapon.\1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `else` statement should set `text.innerText` to `You do not have enough gold to buy a weapon.`.
|
Deine `else`-Anweisung sollte `text.innerText` auf `You do not have enough gold to buy a weapon.` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
gold = 20;
|
gold = 20;
|
||||||
|
|||||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-100
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Create an empty `sellWeapon` function.
|
Erstelle eine leere `sellWeapon`-Funktion.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare a `sellWeapon` variable.
|
Du solltest mit dem `function`-Schlüsselwort eine `sellWeapon`-Variable deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isFunction(sellWeapon);
|
assert.isFunction(sellWeapon);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Deine `sellWeapon`-Funktion sollte eine `if`-Anweisung enthalten.
|
|||||||
assert.match(sellWeapon.toString(), /if/);
|
assert.match(sellWeapon.toString(), /if/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `if` statement should check if `inventory.length` is greater than `1`.
|
Deine `if`-Anweisung sollte prüfen, ob `inventory.length` größer ist als `1`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(sellWeapon.toString(), /if\s*\(inventory\.length\s*>\s*1\)/);
|
assert.match(sellWeapon.toString(), /if\s*\(inventory\.length\s*>\s*1\)/);
|
||||||
|
|||||||
+2
-2
@@ -7,9 +7,9 @@ dashedName: step-103
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Use the `let` keyword to create a variable named `currentWeapon`. Weise ihr noch keinen Wert zu.
|
Verwende das `let`-Schlüsselwort, um eine Variable namens `currentWeapon` zu erstellen. Weise ihr noch keinen Wert zu.
|
||||||
|
|
||||||
Beachte, dass du bereits eine `currentWeapon` in deinem Code hast. Since you are using the `let` keyword instead of `var`, the new `currentWeapon` is scoped only to this `if` statement. At the close of the `if` statement, the old `currentWeapon` will be used again.
|
Beachte, dass du bereits eine `currentWeapon` in deinem Code hast. Da du das `let`-Schlüsselwort anstelle von `var` verwendest, ist der neue `currentWeapon` nur auf diese `if`-Anweisung beschränkt. Am Ende der `if`-Anweisung wird der alte `currentWeapon` erneut verwendet.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -29,13 +29,13 @@ You should add the value of `currentWeapon` to the `You sold a` string. Verwende
|
|||||||
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a\s\1\s*\+\s*\_currentWeapon/);
|
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a\s\1\s*\+\s*\_currentWeapon/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add the string `.` to the value of `currentWeapon`. Verwende den Verkettungsoperator, um dies in derselben Zeile zu tun.
|
Du solltest den String `.` zu dem Wert von `currentWeapon` hinzufügen. Verwende den Verkettungsoperator, um dies in derselben Zeile zu tun.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1\s*\+\s*\_currentWeapon\s+\+\s+('|")\.\2/);
|
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1\s*\+\s*\_currentWeapon\s+\+\s+('|")\.\2/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `text.innerText` should update to the proper string.
|
Dein `text.innerText` sollte auf den richtigen String aktualisiert werden.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
inventory = ["first", "second"];
|
inventory = ["first", "second"];
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ const matches = sellWeapon.toString().match(/text\.innerText\s*\+=/g);
|
|||||||
assert.equal(matches.length, 1);
|
assert.equal(matches.length, 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add the string `In your inventory you have:` to the second `text.innerText` line. Die Abstände sind wichtig.
|
Du solltest den String `In your inventory you have:` zur zweiten `text.innerText`-Zeile hinzufügen. Die Abstände sind wichtig.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(sellWeapon.toString(), /text\.innerText\s*\+=\s*('|") In your inventory you have: \1/);
|
assert.match(sellWeapon.toString(), /text\.innerText\s*\+=\s*('|") In your inventory you have: \1/);
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62a8d7b8ab568b4649998954
|
id: 62a8d7b8ab568b4649998954
|
||||||
title: Step 107
|
title: Schritt 107
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-107
|
dashedName: step-107
|
||||||
---
|
---
|
||||||
@@ -23,7 +23,7 @@ Du solltest `text.innerText` auf `Don't sell your only weapon!` setzen.
|
|||||||
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")Don't sell your only weapon!\1/);
|
assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")Don't sell your only weapon!\1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your new `text.innerText` line should be in your `else` statement.
|
Deine neue `text.innerText`-Zeile sollte sich in deiner `else`-Anweisung befinden.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
inventory = ["Naomi"];
|
inventory = ["Naomi"];
|
||||||
|
|||||||
+4
-4
@@ -9,17 +9,17 @@ dashedName: step-108
|
|||||||
|
|
||||||
Nun kannst du den Code zur Bekämpfung von Monstern starten. To keep your code organized, your `fightDragon` function has been moved for you to be near the other `fight` functions.
|
Nun kannst du den Code zur Bekämpfung von Monstern starten. To keep your code organized, your `fightDragon` function has been moved for you to be near the other `fight` functions.
|
||||||
|
|
||||||
Below your `weapons` array, define a `monsters` variable and assign it an array. Set that array to have three objects, each with a `name`, `level`, and `health` properties. Die Werte des ersten Objekts sollten in dieser Reihenfolge `slime`, `2` und `15` sein. Der zweite sollte `fanged beast`, `8` und `60` sein. Der dritte sollte `dragon`, `20` und `300` sein.
|
Definiere unter deinem `weapons`-Array eine `monsters`-Variable und gib ihr ein Array. Set that array to have three objects, each with a `name`, `level`, and `health` properties. Die Werte des ersten Objekts sollten in dieser Reihenfolge `slime`, `2` und `15` sein. Der zweite sollte `fanged beast`, `8` und `60` sein. Der dritte sollte `dragon`, `20` und `300` sein.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use `const` to declare a `monsters` variable.
|
Du solltest `const` verwenden, um eine `monsters`-Variable zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /const\s*monsters/);
|
assert.match(code, /const\s*monsters/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `monsters` variable should be an array.
|
Deine `monsters`-Variable sollte ein Array sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isArray(monsters);
|
assert.isArray(monsters);
|
||||||
@@ -31,7 +31,7 @@ Deine `monsters` Variable sollte 3 Werte haben.
|
|||||||
assert.lengthOf(monsters, 3);
|
assert.lengthOf(monsters, 3);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `monsters` array should have 3 objects.
|
Dein `monsters`-Array sollte 3 Objekte haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(monsters.every(val => typeof val === "object"));
|
assert(monsters.every(val => typeof val === "object"));
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-111
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Following the same pattern, use that code in the `fightBeast` and `fightDragon` functions. Denke daran, dass `beast` am Index `1` und `dragon` am Index `2` ist. Enferne auch den `console.log`-Aufruf aus deiner `fightDragon`-Funktion.
|
Verwende diesen Code nach demselben Muster in den `fightBeast`- und `fightDragon`-Funktionen. Denke daran, dass `beast` am Index `1` und `dragon` am Index `2` ist. Enferne auch den `console.log`-Aufruf aus deiner `fightDragon`-Funktion.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@ Erstelle am Ende deines Codes zwei leere Funktionen namens `attack` und `dodge`.
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare `attack`.
|
Du solltest das `function`-Schlüsselwort verwenden, um `attack` zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s*attack/);
|
assert.match(code, /function\s*attack/);
|
||||||
@@ -23,7 +23,7 @@ assert.match(code, /function\s*attack/);
|
|||||||
assert.match(attack.toString(), /attack\s*\(\s*\)\s*\{\s*\}/);
|
assert.match(attack.toString(), /attack\s*\(\s*\)\s*\{\s*\}/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the `function` keyword to declare `dodge`.
|
Du solltest das `function`-Schlüsselwort verwenden, um `dodge` zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s*dodge/);
|
assert.match(code, /function\s*dodge/);
|
||||||
|
|||||||
+4
-4
@@ -7,11 +7,11 @@ dashedName: step-113
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Add a new object to the end of the `locations` array, following the same properties as the rest of the objects. Setze `name` auf `fight`, `button text` auf ein Array mit `Attack`, `Dodge` und `Run`, `button functions` auf ein Array mit `attack`, `dodge` und `goTown`, und `text` auf `You are fighting a monster.`.
|
Füge ein neues Objekt am Ende des `locations`-Arrays hinzu, das die gleichen Eigenschaften wie die übrigen Objekte hat. Setze `name` auf `fight`, `button text` auf ein Array mit `Attack`, `Dodge` und `Run`, `button functions` auf ein Array mit `attack`, `dodge` und `goTown`, und `text` auf `You are fighting a monster.`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `locations` array should have 4 values in it.
|
Dein `locations`-Array sollte 4 Werte enthalten.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
console.log(locations);
|
console.log(locations);
|
||||||
@@ -24,7 +24,7 @@ Dein neuer Wert sollte ein Objekt sein.
|
|||||||
assert.isObject(locations[3]);
|
assert.isObject(locations[3]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your new object should have a `name` property set to `fight`.
|
Dein neues Objekt sollte eine `name`-Eigenschaft auf `fight` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[3].name, "fight");
|
assert.equal(locations[3].name, "fight");
|
||||||
@@ -42,7 +42,7 @@ Your new object should have a `button functions` property set to an array with t
|
|||||||
assert.deepEqual(locations[3]["button functions"], [attack, dodge, goTown]);
|
assert.deepEqual(locations[3]["button functions"], [attack, dodge, goTown]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your new object should have a `text` property set to `You are fighting a monster.`.
|
Dein neues Objekt sollte eine `text`-Eigenschaft auf `You are fighting a monster.` gesetzt haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[3].text, "You are fighting a monster.");
|
assert.equal(locations[3].text, "You are fighting a monster.");
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-115
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Below your `update` call, set the `monsterHealth` to be the health of the current monster. Du kannst auf diesen Wert zugreifen, indem du auf die `health`-Eigenschaft von `monsters[fighting]` mittels Punkt-Notation zugreifst.
|
Setze unter deinem `update`-Aufruf die `monsterHealth` auf die Gesundheit des aktuellen Monsters. Du kannst auf diesen Wert zugreifen, indem du auf die `health`-Eigenschaft von `monsters[fighting]` mittels Punkt-Notation zugreifst.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ You should use bracket notation to access the `monsters` array at the `fighting`
|
|||||||
assert.match(goFight.toString(), /monsters\[fighting\]/);
|
assert.match(goFight.toString(), /monsters\[fighting\]/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should assign the value of `monsters[fighting]` to the `monsterHealth` variable.
|
Du solltest der `monsterHealth`-Variable den Wert von `monsters[fighting]` zuweisen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goFight.toString(), /monsterHealth\s*=\s*monsters\[fighting\](\.health|\[('|")health\2\])/);
|
assert.match(goFight.toString(), /monsterHealth\s*=\s*monsters\[fighting\](\.health|\[('|")health\2\])/);
|
||||||
|
|||||||
+4
-4
@@ -7,11 +7,11 @@ dashedName: step-117
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Setze nun die `innerText`-Eigenschaft von `monsterName` auf die `name`-Eigenschaft des aktuellen Monsters. Do the same for `monsterHealthText` and the `health` property.
|
Setze nun die `innerText`-Eigenschaft von `monsterName` auf die `name`-Eigenschaft des aktuellen Monsters. Mache das gleiche für `monsterHealthText` und die `health`-Eigenschaft.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use dot notation to access the `innerText` property of `monsterName`.
|
Du solltest die Punktnotation verwenden, um auf die `innerText`-Eigenschaft von `monsterName` zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goFight.toString(), /monsterName\.innerText/);
|
assert.match(goFight.toString(), /monsterName\.innerText/);
|
||||||
@@ -23,13 +23,13 @@ You should set the `innerText` property of `monsterName` to be the `name` value
|
|||||||
assert.match(goFight.toString(), /monsterName\.innerText\s*=\s*monsters\[fighting\]\.name/);
|
assert.match(goFight.toString(), /monsterName\.innerText\s*=\s*monsters\[fighting\]\.name/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use dot notation to access the `innerText` property of `monsterHealthText`.
|
Du solltest die Punktnotation verwenden, um auf die `innerText`-Eigenschaft von `monsterHealthText` zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goFight.toString(), /monsterHealthText\.innerText/);
|
assert.match(goFight.toString(), /monsterHealthText\.innerText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set the `innerText` property of `monsterHealthText` to be the `health` value of the current monster. Remember that you assigned this value to a `monsterHealth` variable.
|
You should set the `innerText` property of `monsterHealthText` to be the `health` value of the current monster. Denke daran, dass du diesen Wert einer `monsterHealth`-Variable zugewiesen hast.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(goFight.toString(), /monsterHealthText\.innerText\s*=\s*monsterHealth/);
|
assert.match(goFight.toString(), /monsterHealthText\.innerText\s*=\s*monsterHealth/);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Du solltest die Punktnotation verwenden, um auf die `innerText`-Eigenschaft von
|
|||||||
assert.match(attack.toString(), /text\.innerText/);
|
assert.match(attack.toString(), /text\.innerText/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should assign the string `The` to `innerText` property of `text`.
|
Du solltest den String `The` zu der `innerText`-Eigenschaft von `text` zuweisen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1/);
|
assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1/);
|
||||||
|
|||||||
+5
-5
@@ -7,11 +7,11 @@ dashedName: step-119
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
On a new line, add the string `You attack it with your [weapon].` to the `text` value, replacing `[weapon]` with the player's current weapon.
|
Füge in einer neuen Zeile den String `You attack it with your [weapon].` zu deinem `text` Wert hinzu und ersetze damit `[weapon]` mit der aktuellen Waffe des Spielers.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use dot notation to access the `innerText` property of `text` on a new line.
|
Du solltest die Punktnotation verwenden, um in einer neuen Zeile auf die `innerText`-Eigenschaft von `text` zuzugreifen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const match = attack.toString().match(/text\.innerText/g);
|
const match = attack.toString().match(/text\.innerText/g);
|
||||||
@@ -24,19 +24,19 @@ You should use compound assignment with `text.innerText`.
|
|||||||
assert.match(attack.toString(), /text\.innerText\s*\+=/);
|
assert.match(attack.toString(), /text\.innerText\s*\+=/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add the string `You attack it with your` to the `text.innerText` value. Denke daran, dass Leerzeichen wichtig sind.
|
Du solltest den String `You attack it with your` zu deinem `text.innerText`-Wert hinzufügen. Denke daran, dass Leerzeichen wichtig sind.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1/);
|
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the concatenation operator to add the current weapon to the string. Du solltest den aktuellen Wert mit `weapons[currentWeapon].name` erhalten.
|
Du solltest den Verkettungsoperator verwenden, um die aktuelle Waffe zum String hinzuzufügen. Du solltest den aktuellen Wert mit `weapons[currentWeapon].name` erhalten.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name/);
|
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the concatenation operator to end your string with `.`.
|
Du solltest den Verkettungsoperator verwenden, um dein String mit `.` zu beenden.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name\s*\+\s*('|")\.\2/);
|
assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name\s*\+\s*('|")\.\2/);
|
||||||
|
|||||||
+2
-2
@@ -15,13 +15,13 @@ Verwende diesem Muster folgend den Operator zur Addition (`+`), um eine zufälli
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the same `monsterHealth` line you already wrote.
|
Du solltest die gleiche `monsterHealth`-Zeile verwenden, die du bereits geschrieben hast.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.lengthOf(attack.toString().match(/monsterHealth/g), 1);
|
assert.lengthOf(attack.toString().match(/monsterHealth/g), 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add to the `weapons[currentWeapon].power` value.
|
Du solltest den `weapons[currentWeapon].power`-Wert erhöhen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+/);
|
assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+/);
|
||||||
|
|||||||
+3
-3
@@ -7,11 +7,11 @@ dashedName: step-124
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Add an `if` statement to check if `health` is less than or equal to `0`. If it is, call the `lose` function.
|
Füge eine `if`-Anweisung hinzu, um zu überprüfen, ob `health` kleiner oder gleich `0` ist. Wenn dies der Fall sein sollte, solltest du die `lose`-Funktion aufrufen.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `attack` function should have an `if` statement.
|
Deine `attack`-Funktion sollte eine `if`-Anweisung haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /if/);
|
assert.match(attack.toString(), /if/);
|
||||||
@@ -23,7 +23,7 @@ Deine `if`-Anweisung sollte überprüfen, ob `health` kleiner oder gleich `0` is
|
|||||||
assert.match(attack.toString(), /if\s*\(health\s*<=\s*0\)/);
|
assert.match(attack.toString(), /if\s*\(health\s*<=\s*0\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `if` statement should call the `lose` function.
|
Deine `if`-Anweisung sollte die `lose`-Funktion aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /lose\(\)/);
|
assert.match(attack.toString(), /lose\(\)/);
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ Deine `else if`-Anweisung sollte überprüfen, ob `monsterHealth` kleiner oder g
|
|||||||
assert.match(attack.toString(), /else\s*if\s*\(\s*monsterHealth\s*<=\s*0\s*\)/);
|
assert.match(attack.toString(), /else\s*if\s*\(\s*monsterHealth\s*<=\s*0\s*\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `else if` statement should call the `defeatMonster` function.
|
Deine `else if`-Anweisung sollte die `defeatMonster`-Funktion aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /else\s*if\s*\(\s*monsterHealth\s*<=\s*0\s*\)\s*\{\s*defeatMonster/);
|
assert.match(attack.toString(), /else\s*if\s*\(\s*monsterHealth\s*<=\s*0\s*\)\s*\{\s*defeatMonster/);
|
||||||
|
|||||||
+4
-4
@@ -1,17 +1,17 @@
|
|||||||
---
|
---
|
||||||
id: 62a8ee71f018e968a056d369
|
id: 62a8ee71f018e968a056d369
|
||||||
title: Step 126
|
title: Schritt 126
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-126
|
dashedName: step-126
|
||||||
---
|
---
|
||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
At the end of your code, create the `defeatMonster` and `lose` functions. Lasse sie vorerst leer.
|
Erstelle die `defeatMonster`- und `lose`-Funktionen am Ende deines Codes. Lasse sie vorerst leer.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare `defeatMonster`.
|
Du solltest das `function`-Schlüsselwort verwenden, um `defeatMonster` zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s+defeatMonster/);
|
assert.match(code, /function\s+defeatMonster/);
|
||||||
@@ -23,7 +23,7 @@ assert.match(code, /function\s+defeatMonster/);
|
|||||||
assert.match(defeatMonster.toString(), /defeatMonster\s*\(\)\s*\{\s*\}/);
|
assert.match(defeatMonster.toString(), /defeatMonster\s*\(\)\s*\{\s*\}/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the `function` keyword to declare `lose`.
|
Du solltest das `function`-Schlüsselwort verwenden, um `lose` zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s+lose/);
|
assert.match(code, /function\s+lose/);
|
||||||
|
|||||||
+3
-3
@@ -7,17 +7,17 @@ dashedName: step-127
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Inside the `dodge` function, set `text.innerText` equal to the string `You dodge the attack from the [monster]`. Replace `[monster]` with the name of the monster, using the `name` property.
|
Inside the `dodge` function, set `text.innerText` equal to the string `You dodge the attack from the [monster]`. Ersetze `[monster]` mit dem Namen des Monsters, indem du die `name`-Eigenschaft verwendest.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should assign the string `You dodge the attack from the` to the `text.innerText` property. Denke daran, dass Abstände wichtig sind.
|
Du solltest der `text.innerText`-Eigenschaft den String `You dodge the attack from the` zuweisen. Denke daran, dass Abstände wichtig sind.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1/);
|
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should use the concatenation operator to add the name of the monster to the end of the string. Du erhältst dies mit `monster[fighting].name`.
|
Du solltest den Verkettungsoperator verwenden, um den Namen des Monsters am Ende deines Strings hinzuzufügen. Du erhältst dies mit `monster[fighting].name`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1\s*\+\s*monsters\[fighting\]\.name/);
|
assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1\s*\+\s*monsters\[fighting\]\.name/);
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ You should use compound assignment to modify `xp`.
|
|||||||
assert.match(defeatMonster.toString(), /xp\s*\+=/);
|
assert.match(defeatMonster.toString(), /xp\s*\+=/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add the monster's level to `xp`.
|
Du solltest das Level des Monsters zu `xp` hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(defeatMonster.toString(), /xp\s*\+=\s*monsters\[fighting\]\.level/);
|
assert.match(defeatMonster.toString(), /xp\s*\+=\s*monsters\[fighting\]\.level/);
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-133
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Das Wort `Arg!` sollte in Anführungszeichen gesetzt werden. Besides escaping quotes, there is another way you can include quotation marks inside a string.
|
Das Wort `Arg!` sollte in Anführungszeichen gesetzt werden. Neben dem Auslassen von Anführungszeichen gibt es eine weitere Möglichkeit, Anführungszeichen in einen String einzufügen.
|
||||||
|
|
||||||
Wandle die doppelten Anführungszeichen um den String `The monster screams Arg! as it dies. You gain experience points and find gold.` in einfache Anführungszeichen `'` um und füge dann doppelte Anführungszeichen um `Arg!` herum hinzu.
|
Wandle die doppelten Anführungszeichen um den String `The monster screams Arg! as it dies. You gain experience points and find gold.` in einfache Anführungszeichen `'` um und füge dann doppelte Anführungszeichen um `Arg!` herum hinzu.
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -11,65 +11,65 @@ At the end of your code, create a `restart` function. Inside this function, set
|
|||||||
|
|
||||||
Also update the `innerText` properties of `goldText`, `healthText`, and `xpText` to their current values.
|
Also update the `innerText` properties of `goldText`, `healthText`, and `xpText` to their current values.
|
||||||
|
|
||||||
Finally, call the `goTown()` function.
|
Rufe schließlich die `goTown()`-Funktion auf.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare `restart`.
|
Du solltest mit dem `function`-Schlüsselwort `restart` deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s+restart/);
|
assert.match(code, /function\s+restart/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should set `xp` to `0`.
|
Deine `restart`-Funktion sollte `xp` auf `0` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /xp\s*=\s*0/);
|
assert.match(restart.toString(), /xp\s*=\s*0/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should set `health` to `100`.
|
Deine `restart`-Funktion sollte `health` auf `100` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /health\s*=\s*100/);
|
assert.match(restart.toString(), /health\s*=\s*100/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should set `gold` to `50`.
|
Deine `restart`-Funktion sollte `gold` auf `50` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /gold\s*=\s*50/);
|
assert.match(restart.toString(), /gold\s*=\s*50/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should set `currentWeapon` to `0`.
|
Deine `restart`-Funktion sollte `currentWeapon` auf `0` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /currentWeapon\s*=\s*0/);
|
assert.match(restart.toString(), /currentWeapon\s*=\s*0/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should set `inventory` to an array with the string `stick`.
|
Deine `restart`-Funktion sollte `inventory` auf ein Array mit dem String `stick` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /inventory\s*=\s*\[\s*('|")stick\1\s*\]/);
|
assert.match(restart.toString(), /inventory\s*=\s*\[\s*('|")stick\1\s*\]/);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `restart` function should call the `goTown()` function.
|
Deine `restart`-Funktion sollte die `goTown()`-Funktion aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /goTown\(\)/);
|
assert.match(restart.toString(), /goTown\(\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set `goldText.innerText` to the value of `gold`.
|
Du solltest `goldText.innerText` auf den Wert `gold` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /goldText\.innerText\s*=\s*gold/);
|
assert.match(restart.toString(), /goldText\.innerText\s*=\s*gold/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set `healthText.innerText` to the value of `health`.
|
Du solltest `healthText.innerText` auf den Wert `health` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /healthText\.innerText\s*=\s*health/);
|
assert.match(restart.toString(), /healthText\.innerText\s*=\s*health/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should set `xpText.innerText` to the value of `xp`.
|
Du solltest `xpText.innerText` auf den Wert `xp` setzen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(restart.toString(), /xpText\.innerText\s*=\s*xp/);
|
assert.match(restart.toString(), /xpText\.innerText\s*=\s*xp/);
|
||||||
|
|||||||
+5
-5
@@ -7,7 +7,7 @@ dashedName: step-138
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Back to your `attack` function - inside the `else if` block, create another `if` and `else` statement. Wenn der Spieler gegen den Drachen kämpft (`fighting` would be `2`), rufe die Funktion `winGame` auf. Move the `defeatMonster()` call to the `else` block.
|
Zurück zu deiner `attack`-Funktion - erstelle innerhalb des `else if`-Blocks eine weitere `if`- und `else`-Anweisung. Wenn der Spieler gegen den Drachen kämpft (`fighting` would be `2`), rufe die Funktion `winGame` auf. Verschiebe den `defeatMonster()`-Aufruf in den `else`-Block.
|
||||||
|
|
||||||
Hier ist ein Beispiel, das prüft, ob `num` gleich `5` ist:
|
Hier ist ein Beispiel, das prüft, ob `num` gleich `5` ist:
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ if (num === 5) {
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should add a new `if` statement in your `else if` block.
|
Du solltest eine neue `if`-Anweisung in deinem `else if`-Block hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const block = attack.toString().split("else if");
|
const block = attack.toString().split("else if");
|
||||||
@@ -35,21 +35,21 @@ const block = attack.toString().split("else if");
|
|||||||
assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)/);
|
assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should call the `winGame` function in your `if` block.
|
Du solltest die `winGame`-Funktion in deinem `if`-Block aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const block = attack.toString().split("else if");
|
const block = attack.toString().split("else if");
|
||||||
assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)\s*\{\s*winGame\(\)/);
|
assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)\s*\{\s*winGame\(\)/);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should add an `else` block.
|
Du solltest einen `else`-Block hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const block = attack.toString().split("else if");
|
const block = attack.toString().split("else if");
|
||||||
assert.include(block[1], "else");
|
assert.include(block[1], "else");
|
||||||
```
|
```
|
||||||
|
|
||||||
Your `else` block should call the `defeatMonster` function.
|
Dein `else`-Block sollte die `defeatMonster`-Funktion aufrufen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const block = attack.toString().split("else if");
|
const block = attack.toString().split("else if");
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-141
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Add another object in the `locations` array. Alles sollte wie beim `lose`-Objekt sein, außer der `name` sollte `win` und der `text` sollte `You defeat the dragon! YOU WIN THE GAME! 🎉` sein.
|
Füge ein weiteres Objekt im `locations`-Array hinzu. Alles sollte wie beim `lose`-Objekt sein, außer der `name` sollte `win` und der `text` sollte `You defeat the dragon! YOU WIN THE GAME! 🎉` sein.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ Dein siebter `locations`-Wert sollte eine `name`-Eigenschaft mit dem Wert `win`
|
|||||||
assert.equal(locations[6].name, 'win');
|
assert.equal(locations[6].name, 'win');
|
||||||
```
|
```
|
||||||
|
|
||||||
Your seventh `locations` value should have a `button text` array with three `REPLAY?` strings.
|
Dein siebter `locations`-Wert sollte ein `button text`-Array mit drei `REPLAY?`-Strings haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(locations[6]["button text"], ['REPLAY?', 'REPLAY?', 'REPLAY?']);
|
assert.deepEqual(locations[6]["button text"], ['REPLAY?', 'REPLAY?', 'REPLAY?']);
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ Below your `attack` function, create an empty function named `getMonsterAttackVa
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use the `function` keyword to declare `getMonsterAttackValue`.
|
Du solltest das `function`-Schlüsselwort verwenden, um `getMonsterAttackValue` zu deklarieren.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(code, /function\s+getMonsterAttackValue/);
|
assert.match(code, /function\s+getMonsterAttackValue/);
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-144
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Der Angriff des Monsters basiert auf das `level` des Monsters und auf dem `xp` des Spielers. In the `getMonsterAttackValue` function, use `const` to create a variable called `hit`. Weise ihm die Gleichung `(level * 5) - (Math.floor(Math.random() * xp));` zu.
|
Der Angriff des Monsters basiert auf das `level` des Monsters und auf dem `xp` des Spielers. Verwende in der `getMonsterAttackValue`-Funktion `const`, um eine Variable namens `hit` zu erstellen. Weise ihm die Gleichung `(level * 5) - (Math.floor(Math.random() * xp));` zu.
|
||||||
|
|
||||||
Dadurch wird der Angriff des Monsters auf das Fünffache seines `level` minus einer zufälligen Zahl zwischen 0 und dem des Spielers `xp` gesetzt.
|
Dadurch wird der Angriff des Monsters auf das Fünffache seines `level` minus einer zufälligen Zahl zwischen 0 und dem des Spielers `xp` gesetzt.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa1e3c7c3d552fb04f0f18
|
id: 62aa1e3c7c3d552fb04f0f18
|
||||||
title: Step 145
|
title: Schritt 145
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-145
|
dashedName: step-145
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa1e8ccd579330e097ce44
|
id: 62aa1e8ccd579330e097ce44
|
||||||
title: Step 146
|
title: Schritt 146
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-146
|
dashedName: step-146
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa1eec891ed731db227a36
|
id: 62aa1eec891ed731db227a36
|
||||||
title: Step 147
|
title: Schritt 147
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-147
|
dashedName: step-147
|
||||||
---
|
---
|
||||||
@@ -19,7 +19,7 @@ return condition ? true : false;
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should use a ternary to change the `return` value if `hit` is greater than `0`.
|
Du solltest einen ternären Wert verwenden, um den `return` -Wert zu ändern, wenn `hit` größer als `0` ist.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(getMonsterAttackValue.toString(), /return\s+hit\s*>\s*0/);
|
assert.match(getMonsterAttackValue.toString(), /return\s+hit\s*>\s*0/);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa1fed3d4e873366ff3131
|
id: 62aa1fed3d4e873366ff3131
|
||||||
title: Step 148
|
title: Schritt 148
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-148
|
dashedName: step-148
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa20e9cf1be9358f5aceae
|
id: 62aa20e9cf1be9358f5aceae
|
||||||
title: Step 150
|
title: Schritt 150
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-150
|
dashedName: step-150
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa2136fc49b836dfedb959
|
id: 62aa2136fc49b836dfedb959
|
||||||
title: Step 151
|
title: Schritt 151
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-151
|
dashedName: step-151
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa21971e3b743844849985
|
id: 62aa21971e3b743844849985
|
||||||
title: Step 152
|
title: Schritt 152
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-152
|
dashedName: step-152
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-153
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
On every attack, there should be a chance that the player's weapon breaks. At the end of the `attack` function, add an empty `if` expression with the condition `Math.random() <= .1`.
|
Bei jedem Angriff sollte die Möglichkeit bestehen, dass die Waffe des Spielers zerbricht. At the end of the `attack` function, add an empty `if` expression with the condition `Math.random() <= .1`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should add an `if` statement to your `attack` function.
|
Du solltest eine `if`-Anweisung zu deiner `attack`-Funktion hinzufügen.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const ifs = attack.toString().match(/if/g);
|
const ifs = attack.toString().match(/if/g);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa226207f33d3ad4c6f546
|
id: 62aa226207f33d3ad4c6f546
|
||||||
title: Step 154
|
title: Schritt 154
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-154
|
dashedName: step-154
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa22aba186563bcbf2c395
|
id: 62aa22aba186563bcbf2c395
|
||||||
title: Step 155
|
title: Schritt 155
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-155
|
dashedName: step-155
|
||||||
---
|
---
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa234322d4ad3e8bce42cc
|
id: 62aa234322d4ad3e8bce42cc
|
||||||
title: Step 156
|
title: Schritt 156
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-156
|
dashedName: step-156
|
||||||
---
|
---
|
||||||
@@ -11,7 +11,7 @@ We don't want a player's only weapon to break. The logical AND operator checks i
|
|||||||
|
|
||||||
Use the <dfn>logical AND</dfn> operator `&&` to add a second condition to your `if` statement. The player's weapon should only break if `inventory.length` does not equal (`!==`) one.
|
Use the <dfn>logical AND</dfn> operator `&&` to add a second condition to your `if` statement. The player's weapon should only break if `inventory.length` does not equal (`!==`) one.
|
||||||
|
|
||||||
Here is an example of an `if` statement with two conditions:
|
Hier ist ein Beispiel für eine `if`-Anweisung mit zwei Bedingungen:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
if (firstName === "Quincy" && lastName === "Larson") {
|
if (firstName === "Quincy" && lastName === "Larson") {
|
||||||
@@ -21,7 +21,7 @@ if (firstName === "Quincy" && lastName === "Larson") {
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
You should not modify your existing `if` statement.
|
Du solltest deine bestehende `if`-Anweisung nicht ändern.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1/);
|
assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1/);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa2469c77b363fdb4f0e06
|
id: 62aa2469c77b363fdb4f0e06
|
||||||
title: Step 157
|
title: Schritt 157
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-157
|
dashedName: step-157
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa252c3b1073415ba2b898
|
id: 62aa252c3b1073415ba2b898
|
||||||
title: Step 158
|
title: Schritt 158
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-158
|
dashedName: step-158
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa258da314ef42ba0a1858
|
id: 62aa258da314ef42ba0a1858
|
||||||
title: Step 159
|
title: Schritt 159
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-159
|
dashedName: step-159
|
||||||
---
|
---
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa25fcb5837d43b4d9873d
|
id: 62aa25fcb5837d43b4d9873d
|
||||||
title: Step 160
|
title: Schritt 160
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-160
|
dashedName: step-160
|
||||||
---
|
---
|
||||||
@@ -11,19 +11,19 @@ Add another object to your `locations` array. Set `name` to `easter egg`, set `b
|
|||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Your `locations` array should have 8 values.
|
Deine `locations`-Anordnung sollte 8 Werte haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.lengthOf(locations, 8);
|
assert.lengthOf(locations, 8);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your eighth `locations` value should be an object.
|
Dein achter `locations`-Wert sollte ein Objekt sein.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isObject(locations[7]);
|
assert.isObject(locations[7]);
|
||||||
```
|
```
|
||||||
|
|
||||||
Your eighth `locations` value should have a `name` property with the value `easter egg`.
|
Dein achter `locations`-Wert sollte eine `name`-Eigenschaft mit dem Wert `easter egg` haben.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(locations[7].name, "easter egg");
|
assert.equal(locations[7].name, "easter egg");
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa264d23cdaa45a20efada
|
id: 62aa264d23cdaa45a20efada
|
||||||
title: Step 162
|
title: Schritt 162
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-162
|
dashedName: step-162
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-163
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Inside your `while` loop, push a random number between 0 and 10 to the end of the `numbers` array. You can create this random number with `Math.floor(Math.random() * 11)`.
|
Inside your `while` loop, push a random number between 0 and 10 to the end of the `numbers` array. Du kannst diese Zufallszahl mit `Math.floor(Math.random() * 11)` erzeugen.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa27227399d647e1c37a3c
|
id: 62aa27227399d647e1c37a3c
|
||||||
title: Step 164
|
title: Schritt 164
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-164
|
dashedName: step-164
|
||||||
---
|
---
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 62aa27560def7048d7b4a095
|
id: 62aa27560def7048d7b4a095
|
||||||
title: Step 165
|
title: Schritt 165
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-165
|
dashedName: step-165
|
||||||
---
|
---
|
||||||
|
|||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
---
|
---
|
||||||
id: 62aa27c40ca6f04ab8be5fac
|
id: 62aa27c40ca6f04ab8be5fac
|
||||||
title: Step 166
|
title: Schritt 166
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
dashedName: step-166
|
dashedName: step-166
|
||||||
---
|
---
|
||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A `for` loop runs for a specific number of times. We will break down how a `for` loop runs in the next several steps. For now, copy this loop below and paste it at the end of your `pick` function.
|
A `for` loop runs for a specific number of times. Wie eine `for`-Schleife abläuft, werden wir in den nächsten Schritten aufschlüsseln. For now, copy this loop below and paste it at the end of your `pick` function.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
for (let x = 1; x < 5; x++) {
|
for (let x = 1; x < 5; x++) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user