mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
chore(i18n,learn): processed translations (#50966)
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ Füge unter dem `.eye.right`-Element zwei `div`-Elemente mit einer `class` von `
|
||||
|
||||
# --hints--
|
||||
|
||||
Du solltest innerhalb `.penguin-head` zwei `div`-Elemente hinzufügen. Expected `--fcc-expected--` `div` elements, found `--fcc-actual--`.
|
||||
Du solltest innerhalb `.penguin-head` zwei `div`-Elemente hinzufügen. Es wurden `--fcc-expected--` `div`-Elemente erwartet, aber es wurde `--fcc-actual--` gefunden.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('.penguin-head > div')?.length, 7);
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@ dashedName: step-80
|
||||
|
||||
# --description--
|
||||
|
||||
Target the `.foot` elements, and give them a `width` of `15%`, `height` of `30%`, and `background-color` of `orange`.
|
||||
Wähle die `.foot`-Elemente aus und weise ihnen eine `width` von `15%`, eine `height` von `30%` und eine `background-color` von `orange` zu.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -17,19 +17,19 @@ Du solltest den `.foot`-Selektor verwenden.
|
||||
assert.match(code, /\.foot\s*\{/);
|
||||
```
|
||||
|
||||
You should give `.foot` a `width` of `--fcc-expected--`, found `--fcc-actual--`.
|
||||
Du solltest `.foot` eine `width` von `--fcc-expected--` zuweisen, aber es wurde `--fcc-actual--` gefunden.
|
||||
|
||||
```js
|
||||
assert.equal(new __helpers.CSSHelp(document).getStyle('.foot')?.width, '15%');
|
||||
```
|
||||
|
||||
You should give `.foot` a `height` of `--fcc-expected--`, found `--fcc-actual--`.
|
||||
Du solltest `.foot` eine `height` von `--fcc-expected--` zuweisen, aber es wurde `--fcc-actual--` gefunden.
|
||||
|
||||
```js
|
||||
assert.equal(new __helpers.CSSHelp(document).getStyle('.foot')?.height, '30%');
|
||||
```
|
||||
|
||||
You should give `.foot` a `background-color` of `--fcc-expected--`, found `--fcc-actual--`.
|
||||
Du solltest `.foot` eine `background-color` von `--fcc-expected--` zuweisen, aber es wurde `--fcc-actual--` gefunden.
|
||||
|
||||
```js
|
||||
assert.equal(new __helpers.CSSHelp(document).getStyle('.foot')?.backgroundColor, 'orange');
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-45
|
||||
|
||||
# --description--
|
||||
|
||||
During development, it is useful to see the `fieldset` default borders. Sie lassen jedoch den Inhalt zu weit voneinander getrennt erscheinen.
|
||||
Während der Entwicklung ist es nützlich, die `fieldset`-Standardgrenzen einzusehen. Sie lassen jedoch den Inhalt zu weit voneinander getrennt erscheinen.
|
||||
|
||||
Remove the `border`, and add `2rem` of padding only to the top and bottom of each `fieldset`. Achte darauf, das `padding` von links und rechts zu entfernen.
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ Dein zweites neues `div` sollte eine `class` von `guitar` enthalten.
|
||||
assert(document.querySelectorAll('#guitar > div')?.[1]?.classList?.contains('guitar'));
|
||||
```
|
||||
|
||||
Your second new `div` should have an `id` set to `guitar-right`.
|
||||
Dein zweites neues `div` sollte eine `id` von `guitar-right` enthalten.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('#guitar > div')?.[1]?.getAttribute('id') === 'guitar-right');
|
||||
|
||||
+3
-3
@@ -7,17 +7,17 @@ dashedName: step-2
|
||||
|
||||
# --description--
|
||||
|
||||
Within your `body` element, nest a `section` element within a `main` element.
|
||||
Bette innerhalb deines `body`-Elements ein `section`-Element innerhalb eines `main`-Element ein.
|
||||
|
||||
# --hints--
|
||||
|
||||
The first element inside the `body` element should be your `main` element.
|
||||
Das erste Element innerhalb des `body`-Elements sollte dein `main`-Element sein.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('body')?.children?.[0]?.localName === 'main');
|
||||
```
|
||||
|
||||
You should have a `section` element within your `main` element.
|
||||
Du solltest ein `section`-Element innerhalb deines `main`-Elements haben.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('main')?.children?.[0]?.localName === 'section');
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-26
|
||||
|
||||
# --description--
|
||||
|
||||
Erstelle innerhalb deines `thead` ein `tr`-Element. In that, add a `td` and three `th` elements. Within each of the `th` elements, add a `span` element with the `class` set to `sr-only` and the following text, in order: `2019`, `2020`, and `2021`.
|
||||
Erstelle innerhalb deines `thead` ein `tr`-Element. Füge darin ein `td` und drei `th`-Elemente hinzu. Within each of the `th` elements, add a `span` element with the `class` set to `sr-only` and the following text, in order: `2019`, `2020`, and `2021`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ Du solltest einen neuen `.large`-Selektor haben.
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.large'));
|
||||
```
|
||||
|
||||
Your `.large` selector should have a `height` property set to `10px`.
|
||||
Dein `.large`-Selektor sollte eine `height`-Eigenschaft mit dem Wert `10px` enthalten.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.large')?.height === '10px');
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ const zeroPercentSpan = spans.filter(span => span?.innerHTML?.match(/^[\s\n]*0%[
|
||||
assert(zeroPercentSpan[0]?.classList?.contains('bold'));
|
||||
```
|
||||
|
||||
Your `Cholesterol` `span` and your `0mg` text should be wrapped in a `span`.
|
||||
Dein `span`-Element mit `Cholesterol` und dein `0mg`-Text sollten in einem `span`-Element eingebettet sein.
|
||||
|
||||
```js
|
||||
const spans = [...document.querySelector('.daily-value.small-text')?.lastElementChild?.querySelectorAll('span')];
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ assert(document.querySelector('.daily-value.small-text p:last-of-type')?.classLi
|
||||
assert(document.querySelector('.daily-value.small-text p:last-of-type')?.classList?.contains('no-divider'));
|
||||
```
|
||||
|
||||
Your new `div` should have the `class` attribute set to `divider`.
|
||||
Dein neues `div` sollte das `class`-Attribut auf `divider` gesetzt haben.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.daily-value.small-text')?.lastElementChild?.classList?.contains('divider'));
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ dashedName: step-60
|
||||
|
||||
# --description--
|
||||
|
||||
Füge unter deinem `.double-indent`-Element ein neues `p`-Element mit dem Text `Includes 10g Added Sugars 20%` hinzu. Your new `p` element should also be double indented, and have no bottom border. Verwende ein `span`, um die `20%` fettgedruckt zu machen und rechts auszurichten.
|
||||
Füge unter deinem `.double-indent`-Element ein neues `p`-Element mit dem Text `Includes 10g Added Sugars 20%` hinzu. Dein neues `p`-Element sollte ebenfalls doppelt eingerückt sein und keinen unteren Rand besitzen. Verwende ein `span`, um die `20%` fettgedruckt zu machen und rechts auszurichten.
|
||||
|
||||
Erstelle dann nach diesem `p`-Element einen weiteren Trenner.
|
||||
|
||||
@@ -20,7 +20,7 @@ assert(document.querySelector('.daily-value.small-text')?.lastElementChild?.prev
|
||||
assert(document.querySelector('.daily-value.small-text')?.lastElementChild?.localName === 'div');
|
||||
```
|
||||
|
||||
Your new `p` element should have the text `Includes 10g Added Sugars 20%`.
|
||||
Dein neues `p`-Element sollte den Text `Includes 10g Added Sugars 20%` enthalten.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.daily-value.small-text p:last-of-type')?.innerText.match(/Includes 10g Added Sugars[\s|\n]+20%/));
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Ein <dfn>Palindrom</dfn> kann sowohl ein Wort als auch ein Satz sein, das sowohl
|
||||
|
||||
**Hinweis:** Entferne **alle nicht alphanumerischen Zeichen** (Interpunktion, Leerzeichen und Symbole) und setze alles in dieselbe Schreibweise (Klein- oder Großbuchstaben), um nach Palindromen zu filtern.
|
||||
|
||||
We'll pass strings with varying formats, such as `racecar`, `RaceCar`, and `race CAR` among others.
|
||||
Wir übergeben Strings mit unterschiedlichen Formaten, wie zum Beispiel `racecar`, `RaceCar` und `race CAR`.
|
||||
|
||||
Auch Strings mit speziellen Symbolen wie `2A3*3a2`, `2A3 3a2` und `2_A3*3#A2` werden dir übergeben.
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ Now we need some quick styling. Beginne indem du dem `body` eine `background-col
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a `body` selector.
|
||||
Du solltest einen `body`-Selektor haben.
|
||||
|
||||
```js
|
||||
const body = new __helpers.CSSHelp(document).getStyle('body');
|
||||
|
||||
+4
-4
@@ -7,18 +7,18 @@ dashedName: step-9
|
||||
|
||||
# --description--
|
||||
|
||||
Give the `#text` element a `background-color` of `black`, a `color` of `white`, and `10px` of padding on all sides.
|
||||
Gib dem `#text`-Element eine `background-color` von `black`, eine `color` von `white` und `10px` Padding auf allen Seiten.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a `#text` selector.
|
||||
Du solltest einen `#text`-Selektor haben.
|
||||
|
||||
```js
|
||||
const text = new __helpers.CSSHelp(document).getStyle('#text');
|
||||
assert.exists(text);
|
||||
```
|
||||
|
||||
Your `#text` element should have a `background-color` of `black`.
|
||||
Dein `#text`-Element sollte eine `background-color` von `black` haben.
|
||||
|
||||
```js
|
||||
const background = new __helpers.CSSHelp(document).getStyle('#text')?.getPropertyValue('background-color');
|
||||
@@ -32,7 +32,7 @@ const color = new __helpers.CSSHelp(document).getStyle('#text')?.getPropertyValu
|
||||
assert.equal(color, 'white');
|
||||
```
|
||||
|
||||
Your `#text` element should have `10px` of padding on all sides.
|
||||
Dein `#text`-Element sollte `10px` auf allen Seiten haben.
|
||||
|
||||
```js
|
||||
const padding = new __helpers.CSSHelp(document).getStyle('#text')?.getPropertyValue('padding');
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const monsterStats = new __helpers.CSSHelp(document).getStyle('#monsterStats');
|
||||
assert.exists(monsterStats);
|
||||
```
|
||||
|
||||
Your `#monsterStats` selector should have a `display` property of `none`.
|
||||
Dein `#monsterStats`-Selektor sollte eine `display`-Eigenschaft von `none` haben.
|
||||
|
||||
```js
|
||||
const display = new __helpers.CSSHelp(document).getStyle('#monsterStats')?.getPropertyValue('display');
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ dashedName: step-23
|
||||
|
||||
Du hast deine Variablen mit dem Schlüsselwort `var` deklariert. In modernem JavaScript ist es jedoch die beste Praxis, stattdessen das Schlüsselwort `let` zu verwenden. Dies behebt mehrere ungewöhnliche Verhaltensweisen mit `var`, die die Fehlersuche in deinem Code erschweren können.
|
||||
|
||||
Change all of your `var` keywords to `let`.
|
||||
Ändere alle deine `var`-Schlüsselwörter in `let` um.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should not have any `var` keywords in your code.
|
||||
Du solltest keine `var`-Schlüsselwörter in deinem Code haben.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /var/);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62a3b5843544ce3a77459c27
|
||||
title: Step 28
|
||||
title: Schritt 28
|
||||
challengeType: 0
|
||||
dashedName: step-28
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62a3c8bf3980c14c438d2aed
|
||||
title: Step 39
|
||||
title: Schritt 39
|
||||
challengeType: 0
|
||||
dashedName: step-39
|
||||
---
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ Your first `locations` value should have a `text` property.
|
||||
assert.isDefined(locations[0]["text"]);
|
||||
```
|
||||
|
||||
Your `text` property should be a string.
|
||||
Deine `text`-Eigenschaft sollte ein String sein.
|
||||
|
||||
```js
|
||||
assert.isString(locations[0]["text"]);
|
||||
|
||||
+6
-6
@@ -7,17 +7,17 @@ dashedName: step-58
|
||||
|
||||
# --description--
|
||||
|
||||
Add a second object to your `locations` array (remember to separate them with a comma). Erstelle nach dem gleichen Muster wie beim ersten Objekt dieselben Eigenschaften, verwende aber die Werte aus der `goStore` Funktion. Set the `name` property to `store`.
|
||||
Füge ein zweites Objekt zu deinem `locations`-Array hinzu (denke daran, es mit einem Komma zu trennen). Erstelle nach dem gleichen Muster wie beim ersten Objekt dieselben Eigenschaften, verwende aber die Werte aus der `goStore` Funktion. Setze die `name`-Eigenschaft auf `store`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `locations` array should have two values.
|
||||
Dein `locations`-Array sollte zwei Werte haben.
|
||||
|
||||
```js
|
||||
assert.lengthOf(locations, 2);
|
||||
```
|
||||
|
||||
Both `locations` values should be objects.
|
||||
Beide `locations`-Werte sollten Objekte sein.
|
||||
|
||||
|
||||
```js
|
||||
@@ -25,13 +25,13 @@ assert.isObject(locations[0]);
|
||||
assert.isObject(locations[1]);
|
||||
```
|
||||
|
||||
Your second `locations` object should have a `name` property with the value of `store`.
|
||||
Dein zweites `locations`-Objekt sollte eine `name`-Eigenschaft mit dem Wert `store` haben.
|
||||
|
||||
```js
|
||||
assert.equal(locations[1].name, "store");
|
||||
```
|
||||
|
||||
Your second `locations` object should have a `button text` property which is an array.
|
||||
Dein zweites `locations`-Objekt sollte eine `button text`-Eigenschaft haben, die ein Array ist.
|
||||
|
||||
```js
|
||||
assert.isArray(locations[1]["button text"]);
|
||||
@@ -71,7 +71,7 @@ Your second `locations` object should have a `text` property with the value of `
|
||||
assert.equal(locations[1].text, "You enter the store.");
|
||||
```
|
||||
|
||||
You should not modify the first `locations` object.
|
||||
Du solltest das erste `locations`-Objekt nicht ändern.
|
||||
|
||||
```js
|
||||
assert.deepEqual(locations[0], {
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@ dashedName: step-59
|
||||
|
||||
# --description--
|
||||
|
||||
Jetzt kannst du einen Teil deines Codes konsolidieren. Start by copying the code from inside the `goTown` function and paste it into your `update` function. Then, remove all the code from inside the `goTown` and `goStore` functions.
|
||||
Jetzt kannst du einen Teil deines Codes konsolidieren. Beginne, indem du den Code innerhalb der `goTown`-Funktion kopierst und ihn in deine `update`-Funktion einfügst. Entferne dann den gesamten Code innerhalb der `goTown`- und `goStore`-Funktionen.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -17,25 +17,25 @@ Deine `update` Funktion sollte `button1.innerText` auf `Go to store` setzen.
|
||||
assert.match(update.toString(), /button1\.innerText\s*=\s*('|")Go to store\1/);
|
||||
```
|
||||
|
||||
Your `update` function should set `button2.innerText` to `Go to cave`.
|
||||
Deine `update`-Funktion sollte `button2.innerText` auf `Go to cave` setzen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /button2\.innerText\s*=\s*('|")Go to cave\1/);
|
||||
```
|
||||
|
||||
Your `update` function should set `button3.innerText` to `Fight dragon`.
|
||||
Deine `update`-Funktion sollte `button3.innerText` auf `Fight dragon` setzen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /button3\.innerText\s*=\s*('|")Fight dragon\1/);
|
||||
```
|
||||
|
||||
Your `update` function should set `button1.onclick` to `goStore`.
|
||||
Deine `update`-Funktion sollte `button1.onclick` auf `goStore` setzen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /button1\.onclick\s*=\s*goStore/);
|
||||
```
|
||||
|
||||
Your `update` function should set `button2.onclick` to `goCave`.
|
||||
Deine `update`-Funktion sollte `button2.onclick` auf `goCave` setzen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /button2\.onclick\s*=\s*goCave/);
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ Now update `button2.innerText` and `button3.innerText` to be assigned the second
|
||||
|
||||
# --hints--
|
||||
|
||||
You should access the second element of the `button text` property of the `location` argument.
|
||||
Du solltest auf das zweite Element der `button text`-Eigenschaft des `location`-Arguments zugreifen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /location\[('|")button text\1\]\[1\]/);
|
||||
@@ -23,7 +23,7 @@ Du solltest die Eigenschaft `button2.innerText` so einstellen, dass sie das zwei
|
||||
assert.match(update.toString(), /button2\.innerText\s*=\s*location\[('|")button text\1\]\[1\]/);
|
||||
```
|
||||
|
||||
You should access the third element of the `button text` property of the `location` argument.
|
||||
Du solltest auf das dritte Element der `button text`-Eigenschaft des `location`-Arguments zugreifen.
|
||||
|
||||
```js
|
||||
assert.match(update.toString(), /location\[('|")button text\1\]\[2\]/);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ Du solltest `10` zu `health` hinzufügen.
|
||||
assert.match(code, /health\s*=\s*health\s*\+\s*10/);
|
||||
```
|
||||
|
||||
Your `buyHealth` function should increase `health` by `10`.
|
||||
Deine `buyHealth`-Funktion sollte `health` um `10` erhöhen.
|
||||
|
||||
```js
|
||||
health = 10;
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ dashedName: step-77
|
||||
|
||||
# --description--
|
||||
|
||||
The `condition` string is just a placeholder. Ändere die `if`-Anweisungsbedingung, so dass sie überprüft, ob `gold` größer oder gleich `10` ist.
|
||||
Der `condition`-String ist nur ein Platzhalter. Ändere die `if`-Anweisungsbedingung, so dass sie überprüft, ob `gold` größer oder gleich `10` ist.
|
||||
|
||||
Hier ist eine `if`-Anweisung, die überprüft, ob `num` größer oder gleich `5` ist:
|
||||
|
||||
@@ -25,7 +25,7 @@ Deine `if`-Anweisung sollte überprüfen ob `gold` größer oder gleich `10` ist
|
||||
assert.match(buyHealth.toString(), /if\s*\(gold\s*>=\s*10\)/);
|
||||
```
|
||||
|
||||
Your `buyHealth` function should update `health` and `gold` if `gold` is greater than or equal to `10`.
|
||||
Deine `buyHealth`-Funktion sollte `health` und `gold` aktualisieren, wenn `gold` größer oder gleich `10` ist.
|
||||
|
||||
```js
|
||||
gold = 10;
|
||||
@@ -39,7 +39,7 @@ const goldElement = document.getElementById('goldText');
|
||||
assert.equal(goldElement.innerText, '0');
|
||||
```
|
||||
|
||||
Your `buyHealth` function should not update `health` and `gold` if `gold` is less than `10`.
|
||||
Deine `buyHealth`-Funktion sollte `health` und `gold` nicht aktualisieren, wenn `gold` kleiner als `10` ist.
|
||||
|
||||
```js
|
||||
gold = 5;
|
||||
|
||||
+3
-3
@@ -7,17 +7,17 @@ dashedName: step-81
|
||||
|
||||
# --description--
|
||||
|
||||
Just like your `locations` array, your `weapons` array will hold objects. Add four objects to the `weapons` array, each with two properties: `name` and `power`. Der erste sollte den `name` auf `stick` und die `power` auf `5` gesetzt haben. The second should be `dagger` and `30`. The third, `claw hammer` and `50`. The fourth, `sword` and `100`.
|
||||
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`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `weapons` array should have four values.
|
||||
Dein `weapons`-Array sollte vier Werte haben.
|
||||
|
||||
```js
|
||||
assert.lengthOf(weapons, 4);
|
||||
```
|
||||
|
||||
Your `weapons` array should have four objects.
|
||||
Dein `weapons`-Array sollte vier Objekte enthalten.
|
||||
|
||||
```js
|
||||
assert.isObject(weapons[0]);
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ dashedName: step-90
|
||||
|
||||
You can insert variables into a string with the <dfn>concatenation operator</dfn> `+`. Update the `You now have a new weapon.` string to say `You now have a` and the name of the new weapon. Denke daran, den Satz mit einem Punkt zu beenden.
|
||||
|
||||
Here is an example that creates the string `Hello, our name is freeCodeCamp.`:
|
||||
Hier ist ein Beispiel, das den String `Hello, our name is freeCodeCamp.` erzeugt:
|
||||
|
||||
```js
|
||||
const ourName = "freeCodeCamp";
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-96
|
||||
|
||||
# --description--
|
||||
|
||||
Arrays have a `length` property that returns the number of items in the array. You may want to add new values to the `weapons` array in the future.
|
||||
Arrays haben eine `length`-Eigenschaft, die die Anzahl der Elemente im Array zurückgibt. Möglicherweise möchtest du dem `weapons`-Array in Zukunft neue Werte hinzufügen.
|
||||
|
||||
Verändere deine `if`-Bedingung, um zu überprüfen, ob `currentWeapon` kleiner ist als die Länge des `weapons`-Arrays. Zur Überprüfung der Länge eines Arrays `myArray` könnest du beispielsweise `myArray.length` verwenden.
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62a8dd9cdb16324b04cfd958
|
||||
title: Step 110
|
||||
title: Schritt 110
|
||||
challengeType: 0
|
||||
dashedName: step-110
|
||||
---
|
||||
@@ -25,7 +25,7 @@ Du solltest nicht `let` oder `const` verwenden.
|
||||
assert.notMatch(fightSlime.toString(), /let|const|var/);
|
||||
```
|
||||
|
||||
You should call the `goFight` function.
|
||||
Du solltest die `goFight`-Funktion aufrufen.
|
||||
|
||||
```js
|
||||
assert.match(fightSlime.toString(), /goFight\(\);/);
|
||||
|
||||
+2
-2
@@ -17,13 +17,13 @@ Du solltest in deiner `fightBeast`-Funktion `fighting` auf `1` setzen.
|
||||
assert.match(fightBeast.toString(), /fighting\s*=\s*1;/);
|
||||
```
|
||||
|
||||
You should set `fighting` to `2` in your `fightDragon` function.
|
||||
Du solltest in deiner `fightDragon`-Funktion `fighting` auf `2` setzen.
|
||||
|
||||
```js
|
||||
assert.match(fightDragon.toString(), /fighting\s*=\s*2;/);
|
||||
```
|
||||
|
||||
You should remove the `console.log` from your `fightDragon` function.
|
||||
Du solltest den `console.log` aus deiner `fightDragon`-Funktion entfernen.
|
||||
|
||||
```js
|
||||
assert.notMatch(fightDragon.toString(), /console\.log/);
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ dashedName: step-114
|
||||
|
||||
# --description--
|
||||
|
||||
In the `goFight` function, call your `update` function with the fourth object in `locations` as an argument.
|
||||
Rufe in der `goFight`-Funktion deine `update`-Funktion mit dem vierten Objekt in `locations` als Argument auf.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should call `update` in your `goFight` function.
|
||||
Du solltest `update` in deiner `goFight`-Funktion aufrufen.
|
||||
|
||||
```js
|
||||
assert.match(goFight.toString(), /update/);
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-121
|
||||
|
||||
# --description--
|
||||
|
||||
Setze `monsterHealth` auf `monsterHealth` minus die Stärke der aktuellen Waffe des Spielers. Remember you have the `currentWeapon` variable and the `power` property.
|
||||
Setze `monsterHealth` auf `monsterHealth` minus die Stärke der aktuellen Waffe des Spielers. Denke daran, dass du die `currentWeapon`-Variable und die `power`-Eigenschaft hast.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-135
|
||||
|
||||
# --description--
|
||||
|
||||
In the `lose` function, call the `update` function and pass in the sixth object of your `locations` array. Beachte, dass du dieses Objekt noch nicht erstellt hast.
|
||||
Rufe in der `lose`-Funktion die `update`-Funktion auf und reiche das sechste Objekt deines `locations`-Arrays ein. Beachte, dass du dieses Objekt noch nicht erstellt hast.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-140
|
||||
|
||||
# --description--
|
||||
|
||||
After the `lose` function, create a function called `winGame`. Rufe in der `winGame` Funktion die `update` Funktion auf und reiche `locations[6]` ein.
|
||||
Erstelle nach der `lose`-Funktion eine Funktion namens `winGame`. Rufe in der `winGame` Funktion die `update` Funktion auf und reiche `locations[6]` ein.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa1cea594f152ba626b872
|
||||
title: Step 142
|
||||
title: Schritt 142
|
||||
challengeType: 0
|
||||
dashedName: step-142
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa204c1e1d33348ff09944
|
||||
title: Step 149
|
||||
title: Schritt 149
|
||||
challengeType: 0
|
||||
dashedName: step-149
|
||||
---
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-150
|
||||
|
||||
# --description--
|
||||
|
||||
Add an `else` statement to the first `if` statement inside you `attack()` function. In the `else` statement, use the `+=` operator to add the text `You miss.` to the end of `text.innerText`.
|
||||
Füge eine `else`-Anweisung zur ersten `if`-Anweisung innerhalb deiner `attack()`-Funktion hinzu. In the `else` statement, use the `+=` operator to add the text `You miss.` to the end of `text.innerText`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ The player should hit if either `Math.random() > .2` **or** if the player's heal
|
||||
|
||||
At the end of your `return` statement, use the <dfn>logical or</dfn> operator `||` and check if `health` is less than `20`.
|
||||
|
||||
The logical or operator will use the first value if it is truthy – that is, anything apart from `NaN`, `null`, `0`, `-0`, `0n`, `""`, and `false`. Andernfalls wird der zweite Wert verwendet.
|
||||
Der logische Oder-Operator wird den ersten Wert verwenden, wenn er "truthy" ist – das heißt, alles außer `NaN`, `null`, `0`, `-0`, `0n`, `""` und `false`. Andernfalls wird der zweite Wert verwendet.
|
||||
|
||||
For example: `num < 10 || num > 20`.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa21ea8d9d9f396b95dd87
|
||||
title: Step 153
|
||||
title: Schritt 153
|
||||
challengeType: 0
|
||||
dashedName: step-153
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa2626c3c10244b94c787b
|
||||
title: Step 161
|
||||
title: Schritt 161
|
||||
challengeType: 0
|
||||
dashedName: step-161
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa26cca3cd3d46c431e73b
|
||||
title: Step 163
|
||||
title: Schritt 163
|
||||
challengeType: 0
|
||||
dashedName: step-163
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa28032d863d4bd8058799
|
||||
title: Step 167
|
||||
title: Schritt 167
|
||||
challengeType: 0
|
||||
dashedName: step-167
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa287434dc284cea01157c
|
||||
title: Step 168
|
||||
title: Schritt 168
|
||||
challengeType: 0
|
||||
dashedName: step-168
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa28fb651bf14efa2dbb16
|
||||
title: Step 170
|
||||
title: Schritt 170
|
||||
challengeType: 0
|
||||
dashedName: step-170
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62aa2999ec27ec516655eba6
|
||||
title: Step 172
|
||||
title: Schritt 172
|
||||
challengeType: 0
|
||||
dashedName: step-172
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62b46e3a8d4be31be5af793d
|
||||
title: Step 30
|
||||
title: Schritt 30
|
||||
challengeType: 0
|
||||
dashedName: step-30
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62ba17beef16c563069a65d8
|
||||
title: Step 137
|
||||
title: Schritt 137
|
||||
challengeType: 0
|
||||
dashedName: step-137
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 62fc20387ef88d1d1998aac5
|
||||
title: Step 32
|
||||
title: Schritt 32
|
||||
challengeType: 0
|
||||
dashedName: step-32
|
||||
---
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ dashedName: where-do-i-belong
|
||||
|
||||
Наприклад, `getIndexToIns([1,2,3,4], 1.5)` має повертати `1`, оскільки він більший за `1` (індекс 0), але менший за `2` (індекс 1).
|
||||
|
||||
Аналогічно, `getIndexToIns([20,3,5], 19)` має повертати `2`, оскільки після відсортування масиву він виглядатиме як `[3,5,20]`, а `19` менше за `20` (індекс 2) та більше за `5` (індекс 1).
|
||||
Аналогічно, `getIndexToIns([20,3,5], 19)` має повертати `2`, оскільки після сортування масиву він виглядатиме як `[3,5,20]`, а `19` менше за `20` (індекс 2) та більше за `5` (індекс 1).
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5a661e0f1068aca922b3ef17
|
||||
title: Використання дужок для доступу до вмісту масиву
|
||||
title: Доступ до вмісту масиву завдяки дужковій нотації
|
||||
challengeType: 1
|
||||
forumTopicId: 301149
|
||||
dashedName: access-an-arrays-contents-using-bracket-notation
|
||||
@@ -16,7 +16,7 @@ dashedName: access-an-arrays-contents-using-bracket-notation
|
||||
let ourArray = ["a", "b", "c"];
|
||||
```
|
||||
|
||||
У масиві кожен елемент масиву має <dfn>індекс</dfn>. Цей індекс подвоюється як позиція цього елемента в масиві і як ви на нього посилаєтесь. Проте важливо зазначити, що масиви JavaScript мають <dfn>нульовий індекс</dfn>це означає, що перший елемент масиву фактично знаходиться в ***нульовій*** позиції, а не в першій. Щоб отримати елемент з масиву, ми можемо помістити індекс в дужки і додати його в кінець масиву або, що відбувається частіше, до змінної, яка посилається на об'єкт масиву. Такий спосіб називають <dfn>дужки</dfn>. Наприклад, якщо ми хочемо отримати `a` з `ourArray` та призначити йому змінну, ми можемо зробити це за допомогою наступного коду:
|
||||
Кожен елемент масиву має <dfn>індекс</dfn>. Цей індекс подвоюється як позиція цього елемента в масиві і як ви на нього посилаєтесь. Проте важливо зазначити, що масиви JavaScript мають <dfn>нульовий індекс</dfn>, тобто перший елемент масиву фактично знаходиться в ***нульовій*** позиції, а не в першій. Щоб отримати елемент з масиву, ми можемо помістити індекс в дужки і додати його в кінець масиву або, що відбувається частіше, до змінної, яка посилається на об’єкт масиву. Такий спосіб називають <dfn>дужковою нотацією</dfn>. Наприклад, якщо ми хочемо отримати `a` з `ourArray` та призначити його до змінної, ми можемо зробити це за допомогою такого коду:
|
||||
|
||||
```js
|
||||
let ourVariable = ourArray[0];
|
||||
@@ -24,17 +24,17 @@ let ourVariable = ourArray[0];
|
||||
|
||||
Тепер `ourVariable` має значення `a`.
|
||||
|
||||
Крім доступу до значення, пов'язаного з індексом, ви також можете* встановити *індекс для значення, використовуючи таке ж позначення:
|
||||
Крім доступу до значення, пов’язаного з індексом, ви також можете *встановити* індекс на значення, використовуючи таку ж нотацію:
|
||||
|
||||
```js
|
||||
ourArray[1] = "not b anymore";
|
||||
```
|
||||
|
||||
Використовуючи дужки, ми скинули елемент з індексом 1 з рядка `b`, на `not b anymore`. Тепер `ourArray` це `["a", "not b anymore", "c"]`.
|
||||
Використовуючи дужкову нотацію, ми скинули елемент з індексом 1 з рядка `b` на `not b anymore`. Тепер `ourArray` є `["a", "not b anymore", "c"]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Щоб виконати це завдання, встановіть другу позицію (index `1`) для `myArray` на все, що захочете, крім букви `b`.
|
||||
Щоб виконати це завдання, встановіть другу позицію (індекс `1`) для `myArray` на будь-що, окрім букви `b`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7c367417b2b2512b1a
|
||||
title: Доступ до назв властивостей за допомогою дужок
|
||||
title: Доступ до назв властивостей завдяки дужковій нотації
|
||||
challengeType: 1
|
||||
forumTopicId: 301150
|
||||
dashedName: access-property-names-with-bracket-notation
|
||||
@@ -8,18 +8,18 @@ dashedName: access-property-names-with-bracket-notation
|
||||
|
||||
# --description--
|
||||
|
||||
У першому завданні про об'єкт ми згадували використання дужок як спосіб доступу до значень властивостей за допомогою оцінювання змінної. Наприклад, уявіть, що наш об'єкт `foods` використовується в програмі для касового апарату супермаркету. У нас є функція, яка встановлює `selectedFood` і ми хочемо перевірити наш об'єкт `foods` на наявність цієї їжі. Це може виглядати так:
|
||||
У першому завданні про об’єкт ми згадували дужкову нотацію як спосіб доступу до значень властивостей за допомогою оцінювання змінної. Наприклад, уявіть, що наш об’єкт `foods` використовується в програмі для касового апарату супермаркету. У нас є функція, яка встановлює `selectedFood` і ми хочемо перевірити наш об’єкт `foods` на наявність певної їжі. Це може виглядати так:
|
||||
|
||||
```js
|
||||
let selectedFood = getCurrentFood(scannedItem);
|
||||
let inventory = foods[selectedFood];
|
||||
```
|
||||
|
||||
Цей код оцінить значення, яке зберігається в змінній `selectedFood` та поверне значення цього ключа в об'єкт`foods`, або `undefined` якщо він відсутній. Дужки дуже корисні, тому що іноді властивості об'єкта невідомі до часу виконання або нам потрібно отримати до них доступ більш динамічним способом.
|
||||
Цей код оцінить значення, яке зберігається у змінній `selectedFood` та поверне значення цього ключа в об’єкт `foods`, або `undefined`, якщо він відсутній. Дужкова нотація дуже корисна, оскільки іноді властивості об’єкта невідомі до часу виконання або нам потрібно отримати до них доступ більш динамічним способом.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Ми визначили функцію, `checkInventory`, яка отримує відсканований елемент в якості аргументу. Повернути поточне значення ключа `scannedItem` в об'єкті `foods`. Ви можете припустити, що тільки дійсні ключі будуть надані в якості аргументу для `checkInventory`.
|
||||
Ми визначили функцію `checkInventory`, яка отримує просканований товар як аргумент. Поверніть поточне значення ключа `scannedItem` в об’єкті `foods`. Можна припустити, що тільки дійсні ключі будуть надані як аргумент для `checkInventory`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -29,7 +29,7 @@ let inventory = foods[selectedFood];
|
||||
assert.strictEqual(typeof checkInventory, 'function');
|
||||
```
|
||||
|
||||
Об'єкт `foods` повинен мати тільки наступні пари ключових значень: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`.
|
||||
Об’єкт `foods` повинен мати лише такі пари «ключ-значення»: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(foods, {
|
||||
@@ -42,19 +42,19 @@ assert.deepEqual(foods, {
|
||||
});
|
||||
```
|
||||
|
||||
`checkInventory("apples")` повинен повернути `25`.
|
||||
`checkInventory("apples")` має повернути `25`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('apples'), 25);
|
||||
```
|
||||
|
||||
`checkInventory("bananas")` повинен повернути `13`.
|
||||
`checkInventory("bananas")` має повернути `13`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('bananas'), 13);
|
||||
```
|
||||
|
||||
`checkInventory("strawberries")` повинен повернути `27`.
|
||||
`checkInventory("strawberries")` має повернути `27`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('strawberries'), 27);
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d78b2367417b2b2512b0e
|
||||
title: Додати елементи в масив за допомогою функцій push() і unshift()
|
||||
title: Додавання елементів до масиву завдяки push() та unshift()
|
||||
challengeType: 1
|
||||
forumTopicId: 301151
|
||||
dashedName: add-items-to-an-array-with-push-and-unshift
|
||||
@@ -8,9 +8,9 @@ dashedName: add-items-to-an-array-with-push-and-unshift
|
||||
|
||||
# --description--
|
||||
|
||||
Довжина масиву, як і типи даних, які він може містити, не фіксована. Масиви можуть бути створені з будь-якою кількістю елементів, і елементи можуть бути додані або видалені з плином часу; іншими словами, масиви <dfn> мінливі</dfn>. У цьому завданні ми розглянемо два методи, за допомогою яких ми можемо програмно змінювати масив: `Array.push()` і `Array.unshift()`.
|
||||
Довжина масиву, як і типи даних у ньому, не фіксована. Масиви можуть бути створені з будь-якою кількістю елементів, а елементи можуть бути додані або видалені з плином часу. Іншими словами, масиви <dfn>мінливі</dfn>. У цьому завданні ми розглянемо два методи, за допомогою яких ми можемо програмно змінювати масив: `Array.push()` і `Array.unshift()`.
|
||||
|
||||
Обидва методи приймають один або кілька елементів в якості параметрів і додають ці елементи в масив, для якого викликається метод; метод `push()` додає елементи в кінець масиву, а `unshift()` додає елементи на початок. Зверніть увагу:
|
||||
Обидва методи приймають один або кілька елементів як параметри і додають ці елементи в масив, для якого викликається метод. Метод `push()` додає елементи в кінець масиву, а `unshift()` додає елементи на початку. Зверніть увагу:
|
||||
|
||||
```js
|
||||
let twentyThree = 'XXIII';
|
||||
@@ -25,15 +25,15 @@ romanNumerals.unshift('XIX', 'XX');
|
||||
romanNumerals.push(twentyThree);
|
||||
```
|
||||
|
||||
`romanNumerals` мав би значення `['XIX', 'XX', 'XXI', 'XXII', 'XXIII']`. Зверніть увагу, що ми також можемо передавати змінні, що дає нам ще більшу гнучкість при динамічній зміні даних нашого масиву.
|
||||
`romanNumerals` мав би значення `['XIX', 'XX', 'XXI', 'XXII', 'XXIII']`. Зверніть увагу: ми також можемо передавати змінні, що дає більшу гнучкість при динамічній зміні даних масиву.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Ми визначили функцію, `mixedNumbers`, якій ми передаємо масив як аргумент. Змініть функцію за допомогою `push()` та`unshift()` щоб додати `'I', 2, 'three'` на початок масиву і `7, 'VIII', 9` в кінець, щоб повернутий масив містив числа 1-9 по порядку.
|
||||
Ми визначили функцію `mixedNumbers`, якій передаємо масив як аргумент. Змініть функцію за допомогою `push()` й `unshift()`, додавши `'I', 2, 'three'` на початок масиву та `7, 'VIII', 9` в кінець, щоб повернутий масив містив числа від 1 до 9 (послідовно).
|
||||
|
||||
# --hints--
|
||||
|
||||
`mixedNumbers(["IV", 5, "six"])` тепер повинен повернути `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]`
|
||||
Тепер `mixedNumbers(["IV", 5, "six"])` має повернути `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [
|
||||
@@ -49,13 +49,13 @@ assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [
|
||||
]);
|
||||
```
|
||||
|
||||
Функція `mixedNumbers` повинна використовувати `push()` метод
|
||||
Функція `mixedNumbers` повинна використовувати метод `push()`
|
||||
|
||||
```js
|
||||
assert(mixedNumbers.toString().match(/\.push/));
|
||||
```
|
||||
|
||||
Функція `mixedNumbers` повинна використовувати `unshift()` метод
|
||||
Функція `mixedNumbers` повинна використовувати метод `unshift()`
|
||||
|
||||
```js
|
||||
assert(mixedNumbers.toString().match(/\.unshift/));
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d78b3367417b2b2512b11
|
||||
title: Видалити елементи за допомогою функції splice()
|
||||
title: Додавання елементів завдяки splice()
|
||||
challengeType: 1
|
||||
forumTopicId: 301152
|
||||
dashedName: add-items-using-splice
|
||||
@@ -8,7 +8,7 @@ dashedName: add-items-using-splice
|
||||
|
||||
# --description--
|
||||
|
||||
Пам'ятаєте, в попередньому завданні ми згадували, що `splice()` може приймати до трьох параметрів? Що ж, ви можете використовувати третій параметр, що складається з одного або декількох елементів, для додавання в масив. Це може бути неймовірно корисно для швидкої зміни елемента або набору елементів для іншого елемента.
|
||||
Пам’ятаєте, в попередньому завданні ми згадували, що `splice()` може приймати до трьох параметрів? Що ж, ви можете використовувати третій параметр, що складається з одного або декількох елементів, для додавання в масив. Це може бути неймовірно корисно для швидкої зміни елемента або набору елементів.
|
||||
|
||||
```js
|
||||
const numbers = [10, 11, 12, 12, 15];
|
||||
@@ -19,17 +19,17 @@ numbers.splice(startIndex, amountToDelete, 13, 14);
|
||||
console.log(numbers);
|
||||
```
|
||||
|
||||
В другому випадку `12` видалений, і ми додаємо `13` і `14` до того ж індексу. Тепер масив `numbers` буде мати вигляд `[ 10, 11, 12, 13, 14, 15 ]`.
|
||||
Повторний елемент `12` видалений, та ми додали `13` й `14` на цьому індексі. Тепер масив `numbers` буде мати вигляд `[ 10, 11, 12, 13, 14, 15 ]`.
|
||||
|
||||
Тут ми починаємо з масиву чисел. Потім ми передаємо в `splice()` наступне: індекс, з якого слід почати видалення елементів (3), кількість елементів, які потрібно видалити (1), і решта аргументів (13, 14) будуть вставлені, починаючи з того ж індексу. Зверніть увагу, що після `amountToDelete` може бути будь-яка кількість елементів (розділених комами), кожен з яких вставляється.
|
||||
Тут ми починаємо з масиву чисел. Потім ми передаємо до `splice()`: індекс, з якого починаємо видалення елементів (3); кількість елементів, які потрібно видалити (1); решту аргументів (13, 14), які будуть вставлені, починаючи з того ж індексу. Зверніть увагу, що після `amountToDelete` може бути будь-яка кількість елементів (розділених комами), кожен з яких вставляється.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Ми визначили функцію `htmlColorNames`, яка приймає в якості аргументу масив кольорів HTML. Змініть функцію за допомогою `splice()`, щоб видалити перші два елементи масиву і додати `'DarkSalmon'` та `'BlanchedAlmond'` на свої місця.
|
||||
Ми визначили функцію `htmlColorNames`, яка приймає масив кольорів HTML як аргумент. Змініть функцію за допомогою `splice()`, щоб видалити перші два елементи масиву і додати `'DarkSalmon'` та `'BlanchedAlmond'` на відповідні місця.
|
||||
|
||||
# --hints--
|
||||
|
||||
`htmlColorNames` повинен повернути `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]`
|
||||
`htmlColorNames` має повернути `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@@ -50,19 +50,19 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
Функція `htmlColorNames` повинна використовувати `splice()` метод
|
||||
Функція `htmlColorNames` повинна використовувати метод `splice()`
|
||||
|
||||
```js
|
||||
assert(/.splice/.test(code));
|
||||
```
|
||||
|
||||
Вам не слід використовувати `shift()` або `unshift()`.
|
||||
Не використовуйте `shift()` або `unshift()`.
|
||||
|
||||
```js
|
||||
assert(!/shift|unshift/.test(code));
|
||||
```
|
||||
|
||||
Вам не слід використовувати дужки масиву.
|
||||
Не використовуйте дужкову нотацію масиву.
|
||||
|
||||
```js
|
||||
assert(!/\[\d\]\s*=/.test(code));
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7c367417b2b2512b18
|
||||
title: Додавання пар Key-Value (ключ-значення) до об'єктів JavaScript
|
||||
title: Додавання пар ключ-значення до об’єктів JavaScript
|
||||
challengeType: 1
|
||||
forumTopicId: 301153
|
||||
dashedName: add-key-value-pairs-to-javascript-objects
|
||||
@@ -8,7 +8,7 @@ dashedName: add-key-value-pairs-to-javascript-objects
|
||||
|
||||
# --description--
|
||||
|
||||
По суті, об'єкти - це просто набори пар <dfn>ключ-значення</dfn>. Іншими словами, це фрагменти даних (<dfn>значення</dfn>), зіставлені з унікальними ідентифікаторами, що називаються <dfn>властивостями</dfn> (<dfn>ключами</dfn>). Розглянемо приклад:
|
||||
По суті, об’єкти — це просто набори пар <dfn>ключ-значення</dfn>. Іншими словами, це фрагменти даних (<dfn>значення</dfn>), зіставлені з унікальними ідентифікаторами, що називаються <dfn>властивостями</dfn> (<dfn>ключами</dfn>). Розглянемо приклад:
|
||||
|
||||
```js
|
||||
const tekkenCharacter = {
|
||||
@@ -18,19 +18,19 @@ const tekkenCharacter = {
|
||||
};
|
||||
```
|
||||
|
||||
Наведений вище код називає об'єкт персонажа відеоігри Tekken з ім'ям `tekkenCharacter`. У нього є три властивості, кожна з яких відповідає певному значенню. Якщо ви хочете додати додаткову властивість, таку як "origin", це можна зробити, призначивши `origin` об’єкту:
|
||||
Наведений вище код визначає об’єкт персонажа відеоігри «Tekken» під назвою `tekkenCharacter`. У нього є три властивості, кожна з яких відповідає певному значенню. Якщо ви хочете додати додаткову властивість, як-от «origin», це можна зробити, призначивши `origin` до об’єкта:
|
||||
|
||||
```js
|
||||
tekkenCharacter.origin = 'South Korea';
|
||||
```
|
||||
|
||||
Тут використовується крапкова нотація. Якщо ви спостерігали за об'єктом `tekkenCharacter`, то тепер він містить властивість `origin`. У Хвоаранга також було яскраво-помаранчеве волосся. Ви можете додати цю властивість в дужки, виконавши:
|
||||
Тут використовується точкова нотація. Якщо ви спостерігали за об'єктом `tekkenCharacter`, то тепер він містить властивість `origin`. У Хварана також було яскраво-помаранчеве волосся. Ви можете додати цю властивість завдяки дужковій нотації:
|
||||
|
||||
```js
|
||||
tekkenCharacter['hair color'] = 'dyed orange';
|
||||
```
|
||||
|
||||
Позначення в дужках потрібно, якщо у вашій властивості є пробіл або якщо ви хочете використовувати змінну для імені властивості. У наведеному вище випадку властивість розміщується в лапках, щоб позначити її як рядок і вона буде додана точно так, як показано. Без лапок вона буде оцінюватися як змінна, а ім'я властивості буде мати будь-яке значення змінної. Ось приклад зі змінною:
|
||||
Дужкова нотація потрібна, якщо у вашій властивості є пробіл або ви хочете використовувати змінну, щоб назвати властивість. У наведеному вище випадку властивість розміщується в лапках, щоб позначити її як рядок і вона буде додана точно так, як показано. Без лапок вона буде оцінюватися як змінна, а ім’ям властивості буде значення змінної. Ось приклад зі змінною:
|
||||
|
||||
```js
|
||||
const eyes = 'eye color';
|
||||
@@ -38,7 +38,7 @@ const eyes = 'eye color';
|
||||
tekkenCharacter[eyes] = 'brown';
|
||||
```
|
||||
|
||||
Після додавання всіх прикладів об'єкт буде виглядати так:
|
||||
Після додавання всіх прикладів об’єкт буде виглядати так:
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -53,35 +53,35 @@ tekkenCharacter[eyes] = 'brown';
|
||||
|
||||
# --instructions--
|
||||
|
||||
Об'єкт `foods` був створений з трьома записами. Використовуючи обраний синтаксис, додайте до нього ще три записи: `bananas` із значенням `13`, `grapes` із значенням `35`, та `strawberries` із значенням `27`.
|
||||
Об’єкт `foods` був створений з трьома записами. Використовуючи обраний синтаксис, додайте до нього ще три записи: `bananas` зі значенням `13`, `grapes` зі значенням `35` та `strawberries` зі значенням `27`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`foods` повинен бути об'єктом.
|
||||
`foods` має бути об’єктом.
|
||||
|
||||
```js
|
||||
assert(typeof foods === 'object');
|
||||
```
|
||||
|
||||
Об'єкт `foods` повинен мати ключ `bananas` зі значенням `13`.
|
||||
Об’єкт `foods` повинен мати ключ `bananas` зі значенням `13`.
|
||||
|
||||
```js
|
||||
assert(foods.bananas === 13);
|
||||
```
|
||||
|
||||
Об'єкт `foods` повинен мати ключ `grapes` зі значенням `35`.
|
||||
Об’єкт `foods` повинен мати ключ `grapes` зі значенням `35`.
|
||||
|
||||
```js
|
||||
assert(foods.grapes === 35);
|
||||
```
|
||||
|
||||
Об'єкт `foods` повинен мати ключ `strawberries` зі значенням `27`.
|
||||
Об’єкт `foods` повинен мати ключ `strawberries` зі значенням `27`.
|
||||
|
||||
```js
|
||||
assert(foods.strawberries === 27);
|
||||
```
|
||||
|
||||
Пари "ключ-значення" повинні бути встановлені за допомогою крапок або дужок.
|
||||
Встановіть пари ключ-значення, використовуючи дужкову або точкову нотацію.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
||||
+7
-7
@@ -8,7 +8,7 @@ dashedName: check-for-the-presence-of-an-element-with-indexof
|
||||
|
||||
# --description--
|
||||
|
||||
Оскільки масиви можуть бути змінені або *mutated* в будь-який час, немає ніяких гарантій щодо того, де конкретний фрагмент даних буде знаходитися в даному масиві, або що цей елемент все ще існує. На щастя, JavaScript надає нам ще один вбудований метод, `indexOf()`, який дозволяє нам швидко і легко перевіряти наявність елемента в масиві. `indexOf()` приймає елемент як параметр і при запиті - повертає позицію або індекс цього елемента або `-1`, якщо елементу в масиві немає.
|
||||
Оскільки масиви можуть бути змінені або *мутовані* в будь-який час, немає ніяких гарантій щодо того, де буде знаходитися конкретний фрагмент даних в масиві, або що цей елемент взагалі існуватиме. На щастя, JavaScript надає нам ще один вбудований метод `indexOf()`, який дозволяє швидко і легко перевірити наявність елемента в масиві. `indexOf()` приймає елемент як параметр і при виклику повертає позицію чи індекс цього елемента або `-1`, якщо елемента в масиві немає.
|
||||
|
||||
Наприклад:
|
||||
|
||||
@@ -20,11 +20,11 @@ fruits.indexOf('oranges');
|
||||
fruits.indexOf('pears');
|
||||
```
|
||||
|
||||
`indexOf('dates')` повертає `-1`, `indexOf('oranges')` повертає `2`, і `indexOf('pears')` повертає `1` (перший індекс, за яким існує кожен елемент).
|
||||
`indexOf('dates')` повертає `-1`, `indexOf('oranges')` повертає `2`, а `indexOf('pears')` повертає `1` (перший індекс, за якого існує кожен елемент).
|
||||
|
||||
# --instructions--
|
||||
|
||||
`indexOf()` може бути неймовірно корисним для швидкої перевірки наявності елемента в масиві. Ми визначили функцію `quickCheck`, яка приймає в якості аргументів масив і елемент. Змініть функцію використовуючи `indexOf()` так, щоб вона повернула `true` якщо переданий елемент існує в масиві, та `false` якщо не існує.
|
||||
`indexOf()` може бути неймовірно корисним для швидкої перевірки наявності елемента в масиві. Ми визначили функцію `quickCheck`, яка приймає масив і елемент як аргументи. Змініть функцію, використовуючи `indexOf()` так, щоб вона повернула `true`, якщо переданий елемент існує в масиві, та `false`, якщо не існує.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -34,7 +34,7 @@ fruits.indexOf('pears');
|
||||
assert.isBoolean(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms'));
|
||||
```
|
||||
|
||||
`quickCheck(["squash", "onions", "shallots"], "mushrooms")` повинна повернути `false`
|
||||
`quickCheck(["squash", "onions", "shallots"], "mushrooms")` має повернути `false`
|
||||
|
||||
```js
|
||||
assert.strictEqual(
|
||||
@@ -43,7 +43,7 @@ assert.strictEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`quickCheck(["onions", "squash", "shallots"], "onions")` повинна повернути `true`
|
||||
`quickCheck(["onions", "squash", "shallots"], "onions")` має повернути `true`
|
||||
|
||||
```js
|
||||
assert.strictEqual(
|
||||
@@ -52,13 +52,13 @@ assert.strictEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`quickCheck([3, 5, 9, 125, 45, 2], 125)` повинна повернути `true`
|
||||
`quickCheck([3, 5, 9, 125, 45, 2], 125)` має повернути `true`
|
||||
|
||||
```js
|
||||
assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true);
|
||||
```
|
||||
|
||||
`quickCheck([true, false, false], undefined)` повинна повернути `false`
|
||||
`quickCheck([true, false, false], undefined)` має повернути `false`
|
||||
|
||||
```js
|
||||
assert.strictEqual(quickCheck([true, false, false], undefined), false);
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ dashedName: catch-misspelled-variable-and-function-names
|
||||
|
||||
# --description--
|
||||
|
||||
Методи `console.log()` та `typeof` є двома основними способами перевірки проміжних значень та типів виводу програми. Тепер час заглибитися у найпоширеніші помилки. Однією помилкою на синтаксичному рівні, яку можна допустити при швидкому друці, є звичайна орфографічна помилка.
|
||||
Методи `console.log()` та `typeof` є двома основними способами перевірки проміжних значень та типів виводу програми. Тепер час заглибитися у найпоширеніші помилки. Одна помилка на синтаксичному рівні, яку можна допустити при швидкому друці, є звичайною помилкою правопису.
|
||||
|
||||
Якщо символ у назві змінної чи функції буде перенесений, відсутній, або ж матиме неправильний регістр, браузер виконуватиме пошук неіснуючого об’єкта та надсилатиме скарги у формі посилання на помилку. Назви змінних та функцій у JavaScript чутливі до регістру.
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ function loopy() {
|
||||
}
|
||||
```
|
||||
|
||||
Завданням програміста — гарантувати, що кінцева умова, яка вказує програмі на кінець циклу, буде досягнута. Одна помилка полягає в збільшенні або зменшенні змінної лічильника в неправильному напрямку від кінцевої умови. Іншою помилкою є випадкове скидання змінної лічильника або індексу всередині циклу замість збільшення або зменшення.
|
||||
Завданням програміста — гарантувати, що кінцева умова, яка вказує програмі на кінець циклу, буде досягнута. Однією з помилок є зменшення або збільшення змінної лічильника у неправильному від кінцевої умови напрямку. Іншою помилкою є випадкове скидання змінної лічильника або індексу всередині циклу замість збільшення або зменшення.
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ dashedName: use-caution-when-reinitializing-variables-inside-a-loop
|
||||
|
||||
# --instructions--
|
||||
|
||||
Подана нижче функція повинна створити двовимірний масив із `m` рядками та `n` стовпцями з нулів. На жаль, вона не виводить очікуваний результат, оскільки змінна `row` не реініціалізована (встановлена на порожній масив) у зовнішньому циклі. Виправте код так, щоб він повертав правильний 3x2 масив з нулів, який повинен мати такий вигляд: `[[0, 0], [0, 0], [0, 0]]`.
|
||||
Подана нижче функція повинна створити двовимірний масив із `m` рядками та `n` стовпцями з нулів. На жаль, вона не виводить очікуваний результат, оскільки змінна `row` не реініціалізована (встановлена на порожній масив) у зовнішньому циклі. Виправіть код так, щоб він повертав правильний 3x2 масив з нулів, який повинен мати такий вигляд: `[[0, 0], [0, 0], [0, 0]]`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+7
-7
@@ -36,43 +36,43 @@ assert.deepEqual(addTogether(2, 3), 5);
|
||||
assert.deepEqual(addTogether(23, 30), 53);
|
||||
```
|
||||
|
||||
`addTogether("2", 3)` should return `undefined`.
|
||||
`addTogether("2", 3)` має повертати `undefined`.
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether('2', 3));
|
||||
```
|
||||
|
||||
`addTogether(5, undefined)` should return `undefined`.
|
||||
`addTogether(5, undefined)` має повертати `undefined`.
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether(5, undefined));
|
||||
```
|
||||
|
||||
`addTogether("https://www.youtube.com/watch?v=dQw4w9WgXcQ")` should return `undefined`.
|
||||
`addTogether("https://www.youtube.com/watch?v=dQw4w9WgXcQ")` має повертати `undefined`.
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether('https://www.youtube.com/watch?v=dQw4w9WgXcQ'));
|
||||
```
|
||||
|
||||
`addTogether(5)` should return a function.
|
||||
`addTogether(5)` має повертати функцію.
|
||||
|
||||
```js
|
||||
assert.deepEqual(typeof(addTogether(5)), 'function');
|
||||
```
|
||||
|
||||
`addTogether(5)(7)` should return 12.
|
||||
`addTogether(5)(7)` має повертати 12.
|
||||
|
||||
```js
|
||||
assert.deepEqual(addTogether(5)(7), 12);
|
||||
```
|
||||
|
||||
`addTogether(2)([3])` should return `undefined`.
|
||||
`addTogether(2)([3])` має повертати `undefined`.
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether(2)([3]));
|
||||
```
|
||||
|
||||
`addTogether(2, "3")` should return `undefined`.
|
||||
`addTogether(2, "3")` має повертати `undefined`.
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether(2, '3'));
|
||||
|
||||
+19
-19
@@ -19,29 +19,29 @@ setLastName(last)
|
||||
setFullName(first, last)
|
||||
```
|
||||
|
||||
Запустіть тести, щоб побачити очікуваний вивід для кожного методу. These methods must be the only available means of interacting with the object. Each test will declare a new `Person` instance as `new Person('Bob', 'Ross')`.
|
||||
Запустіть тести, щоб побачити очікуваний вивід для кожного методу. Ці методи повинні бути єдиними доступними засобами для взаємодії з об’єктом. Кожен тест оголосить новий екземпляр `Person` як `new Person('Bob', 'Ross')`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should not change the function signature.
|
||||
Ви не повинні змінювати сигнатуру функції.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+Person\s*=\s*function\s*\(\s*first\s*,\s*last\s*\)\s*{/);
|
||||
```
|
||||
|
||||
You should not reassign the `first` parameter.
|
||||
Ви не повинні перепризначати параметр `first`.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /first\s*=\s*/);
|
||||
```
|
||||
|
||||
You should not reassign the `last` parameter.
|
||||
Ви не повинні перепризначати параметр `last`.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /last\s*=\s*/);
|
||||
```
|
||||
|
||||
No properties should be added. `Object.keys(Person).length` should always return 6.
|
||||
Не треба додавати жодних властивостей. `Object.keys(Person).length` завжди має повертати 6.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -51,49 +51,49 @@ person.setFullName('John', 'Smith');
|
||||
assert.lengthOf(Object.keys(person), 6);
|
||||
```
|
||||
|
||||
You should be able to instantiate your `Person` object.
|
||||
Ви повинні мати можливість створити об’єкт `Person`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.instanceOf(person, Person);
|
||||
```
|
||||
|
||||
Your `Person` object should not have a `firstName` property.
|
||||
Об’єкт `Person` не повинен мати властивість `firstName`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.notProperty(person, 'firstName');
|
||||
```
|
||||
|
||||
Your `Person` object should not have a `lastName` property.
|
||||
Об’єкт `Person` не повинен мати властивість `lastName`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.notProperty(person, 'lastName');
|
||||
```
|
||||
|
||||
The `.getFirstName()` method should return the string `Bob`.
|
||||
Метод `.getFirstName()` має повертати рядок `Bob`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.strictEqual(person.getFirstName(), 'Bob');
|
||||
```
|
||||
|
||||
The `.getLastName()` should return the string `Ross`.
|
||||
`.getLastName()` має повертати рядок `Ross`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.strictEqual(person.getLastName(), 'Ross');
|
||||
```
|
||||
|
||||
The `.getFullName()` method should return the string `Bob Ross`.
|
||||
Метод `.getFullName()` має повертати рядок `Bob Ross`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
assert.strictEqual(person.getFullName(), 'Bob Ross');
|
||||
```
|
||||
|
||||
The `.getFullName()` method should return the string `Haskell Ross` after calling `.setFirstName('Haskell')`.
|
||||
Метод `.getFullName()` має повертати рядок `Haskell Ross` після виклику `.setFirstName('Haskell')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -101,7 +101,7 @@ person.setFirstName('Haskell');
|
||||
assert.strictEqual(person.getFullName(), 'Haskell Ross');
|
||||
```
|
||||
|
||||
The `.getFullName()` method should return the string `Bob Curry` after calling `.setLastName('Curry')`.
|
||||
Метод `.getFullName()` має повертати рядок `Bob Curry` після виклику `.setLastName('Curry')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -109,7 +109,7 @@ person.setLastName('Curry');
|
||||
assert.strictEqual(person.getFullName(), 'Bob Curry');
|
||||
```
|
||||
|
||||
The `.getFullName()` method should return the string `Haskell Curry` after calling `.setFullName('Haskell', 'Curry')`.
|
||||
Метод `.getFullName()` має повертати рядок `Haskell Curry` після виклику `.setFullName('Haskell', 'Curry')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -117,7 +117,7 @@ person.setFullName('Haskell', 'Curry');
|
||||
assert.strictEqual(person.getFullName(), 'Haskell Curry');
|
||||
```
|
||||
|
||||
The `.getFirstName()` method should return the string `Haskell` after calling `.setFullName('Haskell', 'Curry')`.
|
||||
Метод `.getFirstName()` має повертати рядок `Haskell` після виклику `.setFullName('Haskell', 'Curry')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -125,7 +125,7 @@ person.setFullName('Haskell', 'Curry');
|
||||
assert.strictEqual(person.getFirstName(), 'Haskell');
|
||||
```
|
||||
|
||||
The `.getLastName()` method should return the string `Curry` after calling `.setFullName('Haskell', 'Curry')`.
|
||||
Метод `.getLastName()` має повертати рядок `Curry` після виклику `.setFullName('Haskell', 'Curry')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -133,7 +133,7 @@ person.setFullName('Haskell', 'Curry');
|
||||
assert.strictEqual(person.getLastName(), 'Curry');
|
||||
```
|
||||
|
||||
The `.getFullName()` method should return the string `Emily Martinez de la Rosa` after calling `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
Метод `.getFullName()` має повертати рядок `Emily Martinez de la Rosa` після виклику `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -141,7 +141,7 @@ person.setFullName('Emily Martinez', 'de la Rosa');
|
||||
assert.strictEqual(person.getFullName(), 'Emily Martinez de la Rosa');
|
||||
```
|
||||
|
||||
The `.getFirstName()` property should return the string `Emily Martinez` after calling `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
Властивість `.getFirstName()` має повертати рядок `Emily Martinez` після виклику `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
@@ -149,7 +149,7 @@ person.setFullName('Emily Martinez', 'de la Rosa');
|
||||
assert.strictEqual(person.getFirstName(), 'Emily Martinez');
|
||||
```
|
||||
|
||||
The `.getLastName()` property should return the string `de la Rosa` after calling `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
Властивість `.getLastName()` має повертати рядок `de la Rosa` після виклику `.setFullName('Emily Martinez', 'de la Rosa')`.
|
||||
|
||||
```js
|
||||
const person = new Person('Bob', 'Ross');
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ dashedName: map-the-debris
|
||||
|
||||
# --description--
|
||||
|
||||
Згідно з третім законом Кеплера, орбітальний період $T$ двох точкових мас, що обертаються навколо одна одної по круговій або еліптичній орбіті, є:
|
||||
Згідно з третім законом Кеплера, орбітальним періодом $T$ двох точкових мас, що обертаються навколо одна одної по круговій або еліптичній орбіті, є:
|
||||
|
||||
$$ T = 2 \pi \sqrt{\frac{a^{3}}{\mu}} $$
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ assert.deepEqual(translatePigLatin('algorithm'), 'algorithmway');
|
||||
assert.deepEqual(translatePigLatin('eight'), 'eightway');
|
||||
```
|
||||
|
||||
Ваша програма повинна обробляти слова, у яких перший голосний звук у середині слова. `translatePigLatin("schwartz")` має повертати рядок `artzschway`.
|
||||
Ваша програма повинна обробляти слова, у яких перший голосний звук розташований у середині слова. `translatePigLatin("schwartz")` має повертати рядок `artzschway`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(translatePigLatin('schwartz'), 'artzschway');
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@ dashedName: palindrome-checker
|
||||
|
||||
**Примітка:** вам потрібно прибрати всі символи, що **не є абетко-цифровими** (розділові знаки, пробіли та символи) і написати весь текст одинаково (великими або малими літерами) для перевірки паліндромів.
|
||||
|
||||
Ми будемо передавати рядки з різними форматами, наприклад `racecar`, `RaceCar` та `race CAR` серед інших.
|
||||
Ми будемо передавати рядки з різними форматами (наприклад, `racecar`, `RaceCar` та `race CAR`).
|
||||
|
||||
Ми також будемо передавати рядки з спеціальними символами, наприклад `2A3*3a2`, `2A3 3a2` та `2_A3*3#A2`.
|
||||
Ми також будемо передавати рядки зі спеціальними символами (наприклад, `2A3*3a2`, `2A3 3a2` та `2_A3*3#A2`).
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4361000cf542c50ff48
|
||||
title: 'Problem 201: Subsets with a unique sum'
|
||||
title: 'Завдання 201: підмножини з унікальною сумою'
|
||||
challengeType: 1
|
||||
forumTopicId: 301841
|
||||
dashedName: problem-201-subsets-with-a-unique-sum
|
||||
@@ -8,9 +8,9 @@ dashedName: problem-201-subsets-with-a-unique-sum
|
||||
|
||||
# --description--
|
||||
|
||||
For any set $A$ of numbers, let $sum(A)$ be the sum of the elements of $A$.
|
||||
Нехай $sum(A)$ буде сумою елементів множини чисел $A$.
|
||||
|
||||
Consider the set $B = \\{1,3,6,8,10,11\\}$. There are 20 subsets of $B$ containing three elements, and their sums are:
|
||||
Розглянемо множину $B = \\{1,3,6,8,10,11\\}$. Існує 20 підмножин $B$, які містять три елементи, а їхні суми дорівнюють:
|
||||
|
||||
$$\begin{align} & sum(\\{1,3,6\\}) = 10 \\\\
|
||||
& sum(\\{1,3,8\\}) = 12 \\\\ & sum(\\{1,3,10\\}) = 14 \\\\
|
||||
@@ -24,11 +24,11 @@ $$\begin{align} & sum(\\{1,3,6\\}) = 10 \\\\
|
||||
& sum(\\{6,8,11\\}) = 25 \\\\ & sum(\\{6,10,11\\}) = 27 \\\\
|
||||
& sum(\\{8,10,11\\}) = 29 \\end{align}$$
|
||||
|
||||
Some of these sums occur more than once, others are unique. For a set $A$, let $U(A,k)$ be the set of unique sums of $k$-element subsets of $A$, in our example we find $U(B,3) = \\{10,12,14,18,21,25,27,29\\}$ and $sum(U(B,3)) = 156$.
|
||||
Деякі з цих сум зустрічаються більше одного разу, інші є унікальними. Нехай $U(A,k)$ буде множиною унікальних сум з $k$-елементних підмножин множини $A$. У прикладі ми знайдемо $U(B,3) = \\{10,12,14,18,21,25,27,29\\}$ та $sum(U(B,3)) = 156$.
|
||||
|
||||
Now consider the $100$-element set $S = \\{1^2, 2^2, \ldots , {100}^2\\}$. $S$ has $100\\,891\\,344\\,545\\,564\\,193\\,334\\,812\\,497\\,256\\;$ $50$-element subsets.
|
||||
Тепер розглянемо $100$-елементну множину $S = \\{1^2, 2^2, \ldots , {100}^2\\}$. $S$ має $100\\,891\\,344\\,545\\,564\\,193\\,334\\,812\\,497\\,256\\;$ $50$-елементних підмножин.
|
||||
|
||||
Determine the sum of all integers which are the sum of exactly one of the $50$-element subsets of $S$, i.e. find $sum(U(S,50))$.
|
||||
Визначте суму всіх цілих чисел, які є сумою однієї з $50$-елементних підмножин $S$, тобто знайдіть $sum(U(S,50))$.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4371000cf542c50ff49
|
||||
title: 'Problem 202: Laserbeam'
|
||||
title: 'Завдання 202: лазерний промінь'
|
||||
challengeType: 1
|
||||
forumTopicId: 301843
|
||||
dashedName: problem-202-laserbeam
|
||||
@@ -8,15 +8,15 @@ dashedName: problem-202-laserbeam
|
||||
|
||||
# --description--
|
||||
|
||||
Three mirrors are arranged in the shape of an equilateral triangle, with their reflective surfaces pointing inwards. There is an infinitesimal gap at each vertex of the triangle through which a laser beam may pass.
|
||||
Три дзеркала розташовані у формі рівностороннього трикутника таким чином, що їхні поверхні, які відбивають світло, повернуті всередину. На кожній вершині цього трикутника є дуже маленька прогалина, через яку може пройти лазерний промінь.
|
||||
|
||||
Label the vertices $A$, $B$ and $C$. There are 2 ways in which a laser beam may enter vertex $C$, bounce off 11 surfaces, then exit through the same vertex: one way is shown below; the other is the reverse of that.
|
||||
Позначимо вершини $A$, $B$ і $C$. Лазерний промінь може ввійти через вершину $C$, відбитись від 11 поверхонь і вийти через ту саму вершину двома способами: перший спосіб наведено нижче, а другий є протилежним до нього.
|
||||
|
||||
<img class="img-responsive center-block" alt="one way in which laser beam may enter vertex C, bounce off 11 surfaces and exit through the same vertex" src="https://cdn.freecodecamp.org/curriculum/project-euler/laserbeam.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="спосіб, в якому лазерний промінь може увійти через вершину С, відскочити від 11 поверхонь та вийти через ту ж вершину" src="https://cdn.freecodecamp.org/curriculum/project-euler/laserbeam.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
There are 80840 ways in which a laser beam may enter vertex $C$, bounce off 1000001 surfaces, then exit through the same vertex.
|
||||
Лазерний промінь може ввійти через вершину $C$, відбитись від 1000001 поверхні та вийти через ту саму вершину 80840 способами.
|
||||
|
||||
In how many ways can a laser beam enter at vertex $C$, bounce off 12017639147 surfaces, then exit through the same vertex?
|
||||
Скількома способами лазерний промінь може ввійти через вершину $C$, відбитись від 12017639147 поверхонь і вийти через ту саму вершину?
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4381000cf542c50ff4a
|
||||
title: 'Problem 203: Squarefree Binomial Coefficients'
|
||||
title: 'Завдання 203: безквадратні біноміальні коефіцієнти'
|
||||
challengeType: 1
|
||||
forumTopicId: 301844
|
||||
dashedName: problem-203-squarefree-binomial-coefficients
|
||||
@@ -8,7 +8,7 @@ dashedName: problem-203-squarefree-binomial-coefficients
|
||||
|
||||
# --description--
|
||||
|
||||
The binomial coefficients $\displaystyle\binom{n}{k}$ can be arranged in triangular form, Pascal's triangle, like this:
|
||||
Біноміальні коефіцієнти $\displaystyle\binom{n}{k}$ можна розташувати у формі трикутника Паскаля:
|
||||
|
||||
$$\begin{array}{ccccccccccccccc} & & & & & & & 1 & & & & & & & \\\\
|
||||
& & & & & & 1 & & 1 & & & & & & \\\\ & & & & & 1 & & 2 & & 1 & & & & & \\\\
|
||||
@@ -16,11 +16,11 @@ $$\begin{array}{ccccccccccccccc} & & & & & & & 1 & & &
|
||||
& & 1 & & 5 & & 10 & & 10 & & 5 & & 1 & & \\\\ & 1 & & 6 & & 15 & & 20 & & 15 & & 6 & & 1 & \\\\
|
||||
1 & & 7 & & 21 & & 35 & & 35 & & 21 & & 7 & & 1 \\\\ & & & & & & & \ldots \end{array}$$
|
||||
|
||||
It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.
|
||||
Можна побачити, що перші вісім рядків трикутника Паскаля містять дванадцять різних чисел: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 та 35.
|
||||
|
||||
A positive integer n is called squarefree if no square of a prime divides n. Of the twelve distinct numbers in the first eight rows of Pascal's triangle, all except 4 and 20 are squarefree. The sum of the distinct squarefree numbers in the first eight rows is 105.
|
||||
Натуральне число n називається безквадратним, якщо n не ділиться на жоден квадрат простого числа. З дванадцяти різних чисел в перших восьми рядках трикутника Паскаля, всі, окрім 4 та 20, є безквадратними. Сума всіх безквадратних чисел в перших восьми рядках дорівнює 105.
|
||||
|
||||
Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's triangle.
|
||||
Знайдіть суму всіх безквадратних чисел в межах 51 рядка трикутника Паскаля.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user