mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-15 04:01:27 -04:00
chore(i18n,learn): processed translations (#50499)
This commit is contained in:
@@ -51,6 +51,12 @@ assert(gloveBoxContents === 'maps');
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ dashedName: add-font-awesome-icons-to-all-of-our-buttons
|
||||
|
||||
باستخدام Font Awesome, كم بإضافة `info-circle` إلى زر المعلومات, وأيقونة `trash` إلى زر الحذف.
|
||||
|
||||
**لاحظ:** يكون عنصر `span` بديل مقبول لعنصر `i` للمتطلبات بالأدنى.
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ assert(gloveBoxContents === 'maps');
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome 是一個非常便利的圖標庫。 這些圖標可以是網絡字
|
||||
|
||||
爲 info 按鈕添加 Font Awesome `info-circle` 圖標,delete 按鈕添加 `trash` 圖標。
|
||||
|
||||
**注意:** 下述要求中的 `i` 元素也可以用 `span` 元素代替。
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ assert(gloveBoxContents === 'maps');
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome 是一个非常便利的图标库。 这些图标可以是网络字
|
||||
|
||||
为 info 按钮添加 Font Awesome `info-circle` 图标,delete 按钮添加 `trash` 图标。
|
||||
|
||||
**注意:** 下述要求中的 `i` 元素也可以用 `span` 元素代替。
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ Tu código debe utilizar notación de puntos y de corchetes para acceder a `mySt
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome es una conveniente librería de iconos. Estos pueden ser fuentes we
|
||||
|
||||
Utiliza Font Awesome para agregar un icono `info-circle` a su botón info y un icono `trash` al botón borrar.
|
||||
|
||||
**Nota:**El elemento `span` es una alternativa aceptable al elemento `i` para las direcciones a continuación.
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ Dein Code sollte die Punkt- und Klammerschreibweise verwenden, um auf `myStorage
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome ist eine komfortable Bibliothek für Icons. Diese Icons können Web
|
||||
|
||||
Benutze Font Awesome um ein `info-circle`-Icon zu deinem Informationsbutton hinzuzufügen und ein `trash`-Icon zu deinem Lösch-Button.
|
||||
|
||||
**Hinweis:** Das `span` Element ist eine akzeptable Alternative zum `i`-Element für die untenstehenden Anweisungen.
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const containerSecondChild = [...document.querySelector('.container')?.children]
|
||||
assert(containerSecondChild?.classList?.contains('marker') && containerSecondChild.classList?.contains('two'));
|
||||
```
|
||||
|
||||
You should add the class `three` to the third marker `div` element in the `container` `div`.
|
||||
Du solltest die Klasse `three` zum zweiten `div`-Markierungselement im `container` `div` hinzufügen.
|
||||
|
||||
```js
|
||||
const containerThirdChild = [...document.querySelector('.container')?.children][2];
|
||||
|
||||
@@ -7,9 +7,9 @@ dashedName: step-53
|
||||
|
||||
# --description--
|
||||
|
||||
As you can see, the `linear-gradient` function produced a smooth red-green gradient. While the `linear-gradient` function needs a minimum of two color arguments to work, it can accept many color arguments.
|
||||
Wie du sehen kannst, produziert die `linear-gradient`-Funktion einen sanften, rot-grünen Farbverlauf. Während die `linear-gradient`-Funktion mindestens zwei Farbargumenten benötigt, um zu funktionieren, kann sie viele Farbargumente akzeptieren.
|
||||
|
||||
Use the `rgb` function to add pure blue as the third color argument to the `linear-gradient` function.
|
||||
Verwende die `rgb`-Funktion, um der `linear-gradient`-Funktion reines Blau als drittes Farbargument hinzuzufügen.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -59,14 +59,14 @@ const title = document.querySelector('title');
|
||||
assert.exists(title);
|
||||
```
|
||||
|
||||
Your project should have a title of `Magazine`.
|
||||
Dein Projekt sollte den Titel `Magazine` tragen.
|
||||
|
||||
```js
|
||||
const title = document.querySelector('title');
|
||||
assert.equal(title?.text?.trim()?.toLowerCase(), 'magazine')
|
||||
```
|
||||
|
||||
Remember, the casing and spelling matter for the title.
|
||||
Denke daran, dass Schreibweise und Rechtschreibung für den Titel wichtig sind.
|
||||
|
||||
```js
|
||||
const title = document.querySelector('title');
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-95
|
||||
|
||||
# --description--
|
||||
|
||||
Now, you are going to use CSS animations to make the penguin wave.
|
||||
Jetzt wirst du CSS-Animationen verwenden, um die Pinguin-Welle zu erzeugen.
|
||||
|
||||
Define a new `@keyframes` named `wave`.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-64
|
||||
|
||||
# --description--
|
||||
|
||||
Remove the `background-color` property and value from `.bb4`, and add it to the three new sections `.bb4a`, `.bb4b`, and `.bb4c`, so only the sections are filled.
|
||||
Entferne die `background-color`-Eigenschaft und den Wert aus `.bb4` und füge sie den drei neuen Abschnitten `.bb4a`, `.bb4b` und `.bb4c` hinzu, sodass nur die Abschnitte gefüllt werden.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ Within the `ul` element nest three list items to display three things cats love:
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have three `li` elements. Each `li` element should have its own opening and closing tag.
|
||||
Du solltest drei `li`-Elemente haben. Each `li` element should have its own opening and closing tag.
|
||||
|
||||
```js
|
||||
assert($('li').length === 3 && code.match(/<\/li\>/g).length === 3);
|
||||
```
|
||||
|
||||
You should have three `li` elements with the text `cat nip`, `laser pointers` and `lasagna` in any order. You have either omitted some text or have a typo.
|
||||
Du solltest drei `li`-Elemente mit dem Text `cat nip`, `laser pointers` und `lasagna` in beliebiger Reihenfolge haben. Du hast entweder etwas Text weggelassen oder einen Tippfehler gemacht.
|
||||
|
||||
```js
|
||||
assert.deepStrictEqual(
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-27
|
||||
|
||||
# --description--
|
||||
|
||||
Within each corresponding `label` element, and immediately after the `input` element, add a space and add the following text:
|
||||
Füge innerhalb jedes dazugehörigen `label`-Elements und unmittelbar nach dem `input`-Element ein Leerzeichen ein und füge den folgenden Text hinzu:
|
||||
|
||||
```md
|
||||
Personal Account
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-48
|
||||
|
||||
# --description--
|
||||
|
||||
It would be nicer to have the `label` text appear above the form elements.
|
||||
Es wäre besser, wenn der `label`-Text über den Formularelementen erscheinen würde.
|
||||
|
||||
Select all `input`, `textarea`, and `select` elements, and make them take up the full width of their parent elements.
|
||||
|
||||
@@ -15,41 +15,41 @@ Also, add `10px` of `margin` to the top of the selected elements. Set the other
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use a comma separated element selector to select the `input`, `textarea`, and `select` elements.
|
||||
Du solltest einen Elementselektor, der mit Kommas getrennt ist, verwenden, um die `input`-, `textarea`- und `select`-Elemente auszuwählen.
|
||||
|
||||
```js
|
||||
assert.isTrue(['input, textarea, select', 'input, select, textarea', 'select, input, textarea', 'select, textarea, input', 'textarea, input, select', 'textarea, select, input'].some(selector => new __helpers.CSSHelp(document).getStyle(selector)));
|
||||
```
|
||||
|
||||
You should set the `width` property to `100%`.
|
||||
Du solltest die `width`-Eigenschaft auf `100%` setzen.
|
||||
|
||||
```js
|
||||
const selFunc = (selector) => new __helpers.CSSHelp(document).getStyle(selector);
|
||||
assert.equal(selFunc(['input, textarea, select', 'input, select, textarea', 'select, input, textarea', 'select, textarea, input', 'textarea, input, select', 'textarea, select, input'].find(selFunc))?.width, '100%');
|
||||
```
|
||||
|
||||
You should set the `margin-top` property to `10px`.
|
||||
Du solltest die `margin-top`-Eigenschaft auf `10px` setzen.
|
||||
|
||||
```js
|
||||
const selFunc = (selector) => new __helpers.CSSHelp(document).getStyle(selector);
|
||||
assert.equal(selFunc(['input, textarea, select', 'input, select, textarea', 'select, input, textarea', 'select, textarea, input', 'textarea, input, select', 'textarea, select, input'].find(selFunc))?.marginTop, '10px');
|
||||
```
|
||||
|
||||
You should set the `margin-bottom` property to `0`.
|
||||
Du solltest die `margin-bottom`-Eigenschaft auf `0` setzen.
|
||||
|
||||
```js
|
||||
const selFunc = (selector) => new __helpers.CSSHelp(document).getStyle(selector);
|
||||
assert.equal(selFunc(['input, textarea, select', 'input, select, textarea', 'select, input, textarea', 'select, textarea, input', 'textarea, input, select', 'textarea, select, input'].find(selFunc))?.marginBottom, '0px');
|
||||
```
|
||||
|
||||
You should set the `margin-left` property to `0`.
|
||||
Du solltest die `margin-left`-Eigenschaft auf `0` setzen.
|
||||
|
||||
```js
|
||||
const selFunc = (selector) => new __helpers.CSSHelp(document).getStyle(selector);
|
||||
assert.equal(selFunc(['input, textarea, select', 'input, select, textarea', 'select, input, textarea', 'select, textarea, input', 'textarea, input, select', 'textarea, select, input'].find(selFunc))?.marginLeft, '0px');
|
||||
```
|
||||
|
||||
You should set the `margin-right` property to `0`.
|
||||
Du solltest die `margin-right`-Eigenschaft auf `0` setzen.
|
||||
|
||||
```js
|
||||
const selFunc = (selector) => new __helpers.CSSHelp(document).getStyle(selector);
|
||||
|
||||
@@ -13,14 +13,14 @@ Lastly, for the submit button, you want to separate it from the `fieldset` above
|
||||
|
||||
# --hints--
|
||||
|
||||
You should not change the `width` property. Use the `min-width` property.
|
||||
Du solltest die `width`-Eigenschaft nicht ändern. Verwende die `min-width`-Eigenschaft.
|
||||
|
||||
```js
|
||||
assert.equal(new __helpers.CSSHelp(document).getStyle('input[type="submit"]')?.width, '60%');
|
||||
assert.isNotEmpty(new __helpers.CSSHelp(document).getStyle('input[type="submit"]')?.minWidth);
|
||||
```
|
||||
|
||||
You should use the existing `margin` property to include `1em` on the top and bottom.
|
||||
Du solltest die vorhandene `margin`-Eigenschaft verwenden, um `1em` oben und unten einzuschließen.
|
||||
|
||||
```js
|
||||
assert.equal(new __helpers.CSSHelp(document).getStyle('input[type="submit"]')?.margin, '1em auto');
|
||||
|
||||
@@ -11,13 +11,13 @@ Create an `.medium` selector and give it a `height` property of `5px`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should create an `.medium` selector.
|
||||
Du solltest einen `.medium`-Selektor erstellen.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.medium'));
|
||||
```
|
||||
|
||||
Your `.medium` selector should have a `height` property set to `5px`.
|
||||
Dein `.medium`-Selektor sollte eine `height`-Eigenschaft haben, die auf `5px` eingestellt ist.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.medium')?.height === '5px');
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-48
|
||||
|
||||
# --description--
|
||||
|
||||
The bottom borders under your `% Daily Value *` and `Saturated Fat 1g 5%` elements do not extend the full width of the label. Add `no-divider` to the `class` for these two elements.
|
||||
The bottom borders under your `% Daily Value *` and `Saturated Fat 1g 5%` elements do not extend the full width of the label. Füge für diese zwei Elemente `no-divider` zu der `class` hinzu.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ dashedName: step-64
|
||||
|
||||
# --description--
|
||||
|
||||
Create the final `p` element for your `.daily-value` section. Give it the text `Potassium 235mg 6%`. Align the `6%` text to the right, and remove the bottom border of the `p` element.
|
||||
Create the final `p` element for your `.daily-value` section. Gib ihm den Text `Potassium 235mg 6%`. Align the `6%` text to the right, and remove the bottom border of the `p` element.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should create a new `p` element at the end of your `.daily-value` element.
|
||||
Du solltest ein neues `p`-Element am Ende deines `.daily-value`-Elements erstellen.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.daily-value.small-text')?.lastElementChild?.localName === 'p');
|
||||
@@ -35,7 +35,7 @@ Your new `p` element should have a `span` element.
|
||||
assert(document.querySelector('.daily-value.small-text')?.lastElementChild?.querySelectorAll('span')?.length === 1);
|
||||
```
|
||||
|
||||
Your `span` element should not be bold.
|
||||
Dein `span`-Element sollte nicht fettgedruckt sein.
|
||||
|
||||
```js
|
||||
assert(!document.querySelector('.daily-value.small-text')?.lastElementChild?.querySelector('span')?.classList?.contains('bold'));
|
||||
|
||||
@@ -51,6 +51,12 @@ Il tuo codice dovrebbe utilizzare la notazione a punti e parentesi per accedere
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome è una comoda libreria di icone. Queste icone possono essere font w
|
||||
|
||||
Usa Font Awesome per aggiungere un'icona `info-circle` al tuo pulsante info e un'icona `trash` al tuo pulsante di eliminazione.
|
||||
|
||||
**Nota:** L'elemento `span` è un'alternativa accettabile all'elemento `i` per le istruzioni sottostanti.
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-5
|
||||
|
||||
# --description--
|
||||
|
||||
Puoi avere più elementi `meta` a chiusura automatica su una pagina web. Each `meta` element adds information about the page that cannot be expressed by other HTML elements.
|
||||
Puoi avere più elementi `meta` a chiusura automatica su una pagina web. Ogni elemento `meta` aggiunge alla pagina informazioni che non possono essere espresse da altri elementi HTML.
|
||||
|
||||
Aggiungi un altro elemento `meta` a chiusura automatica all'interno dell'elemento `head`. Assegnagli un attributo `name` con il valore `viewport` e un attributo `content` con il valore `width=device-width, initial-scale=1.0`, in modo che la pagina abbia lo stesso aspetto su tutti i dispositivi.
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ assert(gloveBoxContents === 'maps');
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome は便利なアイコンライブラリです。 アイコンはウ
|
||||
|
||||
Font Awesome を使用して、info ボタンに `info-circle` アイコンを追加し、delete ボタンに `trash` アイコンを追加してください。
|
||||
|
||||
**注: **以下の手順では `i` 要素の代わりに `span` 要素を使用することもできます。
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ O código deve usar notação de ponto e de colchetes para acessar `myStorage`.
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` ainda deve ser declarada com `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome é uma biblioteca conveniente de ícones. Estes ícones podem ser f
|
||||
|
||||
Utilize Font Awesome para adicionar um ícone `info-circle` ao botão de informação e um ícone `trash` para o botão de deleção.
|
||||
|
||||
**Observação:** o elemento `span` é uma alternativa aceitável ao elemento `i` para as instruções abaixo.
|
||||
**Observação:** você pode usar os elementos `i` ou `span` para concluir este desafio.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ dashedName: step-3
|
||||
|
||||
# --description--
|
||||
|
||||
You will be using this as an event listener for the `sortButton`. Because buttons associated with a `form` element submit by default, you need to prevent that behavior. Call `event.preventDefault()` in your function to do this.
|
||||
Você usará isto como um "ouvinte" de evento para o `sortButton`. Como os botões associados a um elemento `form` enviam o formulário por padrão, você precisa evitar esse comportamento. Faça a chamada de `event.preventDefault()` na função para isso.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `sortInputArray` function should call `event.preventDefault()`.
|
||||
A função `sortInputArray` deve chamar `event.preventDefault()`.
|
||||
|
||||
```js
|
||||
assert.match(sortInputArray.toString(), /event\.preventDefault\(\)/);
|
||||
|
||||
@@ -7,23 +7,23 @@ dashedName: step-4
|
||||
|
||||
# --description--
|
||||
|
||||
To test your code as you write it, mount an event listener to your `sortButton` element. It should listen for the `click` event, and take `sortInputArray` as the callback.
|
||||
Para testar o código enquanto o escreve, prepare um "ouvinte" de evento no elemento `sortButton`. Ele deve "ouvir" o evento de `click` e receber `sortInputArray` como a função de callback.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should call the `.addEventListener()` method on your `sortButton` element.
|
||||
Você deve chamar o método `.addEventListener()` no elemento `sortButton`.
|
||||
|
||||
```js
|
||||
assert.match(code, /sortButton\s*\.\s*addEventListener\s*\(/);
|
||||
```
|
||||
|
||||
Your `.addEventListener()` method should listen for the `click` event.
|
||||
O método `.addEventListener()` deve "ouvir" o evento de `click`.
|
||||
|
||||
```js
|
||||
assert.match(code, /sortButton\s*\.\s*addEventListener\s*\(\s*('|"|`)click\1\s*,/);
|
||||
```
|
||||
|
||||
Your `.addEventListener()` method should take `sortInputArray` as the callback. Remember to pass the function reference, not the function call.
|
||||
O método `.addEventListener()` deve receber `sortInputArray` como a função de callback. Lembre-se de passar a referência da função, não a chamada da função.
|
||||
|
||||
```js
|
||||
assert.match(code, /sortButton\s*\.\s*addEventListener\s*\(\s*('|"|`)click\1\s*,\s*sortInputArray\s*\)/);
|
||||
|
||||
@@ -7,35 +7,35 @@ dashedName: step-15
|
||||
|
||||
# --description--
|
||||
|
||||
Because you need to compare elements, you'll need to use a nested `for` loop. This loop should iterate through every element in the array *except* the last one. Use `j` as your inner loop's iterator variable.
|
||||
Como você precisa comparar elementos, você precisará usar um laço `for` aninhado. Esse laço deve percorrer todos os elementos do array *exceto* o último. Use `j` como sua variável de iteração do laço interno.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a nested `for` loop.
|
||||
Você deve ter um laço `for` aninhado.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(/);
|
||||
```
|
||||
|
||||
Your inner `for` loop should initialize `j` to `0`.
|
||||
O laço `for` interno deve inicializar `j` como `0`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;/);
|
||||
```
|
||||
|
||||
Your inner `for` loop should iterate through every element in the array *except* the last one.
|
||||
O laço `for` interno deve iterar através de todos os elementos do array *exceto* o último.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)/);
|
||||
```
|
||||
|
||||
Your inner `for` loop should increment `j` by `1` each time.
|
||||
O laço `for` interno deve incrementar `j` em `1` a cada vez que é executado.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)/);
|
||||
```
|
||||
|
||||
Your inner `for` loop should be empty.
|
||||
O laço `for` interno deve estar vazio.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*}\s*}/);
|
||||
|
||||
@@ -13,25 +13,25 @@ Para fazer isso, declare uma variável `temp` e atribua a ela o valor de `array[
|
||||
|
||||
# --hints--
|
||||
|
||||
Within your `if` statement, you should declare a `temp` variable.
|
||||
Dentro da instrução `if`, você deve declarar uma variável `temp`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s*temp\s*=/);
|
||||
```
|
||||
|
||||
You should assign `temp` the value of `array[j]`.
|
||||
Você deve atribuir para `temp` o valor de `array[j]`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s*temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?/);
|
||||
```
|
||||
|
||||
You should assign `array[j]` the value of `array[j + 1]`.
|
||||
Você deve atribuir a `array[j]` o valor de `array[j + 1]`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s*temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?/);
|
||||
```
|
||||
|
||||
You should assign `array[j + 1]` the value of `temp`.
|
||||
Você deve atribuir a `array[j + 1]` o valor de `temp`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s*temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?/);
|
||||
|
||||
@@ -7,11 +7,11 @@ dashedName: step-20
|
||||
|
||||
# --description--
|
||||
|
||||
Finally, after your outer loop has finished executing, return the sorted array.
|
||||
Por fim, após o término da execução do laço externo, retorne o array ordenado.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should `return` the `array` variable.
|
||||
A instrução `return` deve retornar a variável `array`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+bubbleSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s*temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?\s*}\s*}\s*}\s*return\s*array;?\s*}/);
|
||||
|
||||
@@ -7,13 +7,13 @@ dashedName: step-21
|
||||
|
||||
# --description--
|
||||
|
||||
Click your `Sort` button to see your bubble sort algorithm in action! If you open the console, you can watch the steps the algorithm takes.
|
||||
Clique no botão `Sort` para ver o algoritmo de ordenação de bolha em ação! Se você abrir o console, poderá ver as etapas que o algoritmo executa.
|
||||
|
||||
Now that you have confirmed it works, remove your `console.log()` call.
|
||||
Agora que você confirmou que funciona, remova a chamada de `console.log()`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should remove your `console.log()` call.
|
||||
Você deve remover a chamada do `console.log()`.
|
||||
|
||||
```js
|
||||
// Thanks loop-protect
|
||||
|
||||
@@ -7,49 +7,49 @@ dashedName: step-26
|
||||
|
||||
# --description--
|
||||
|
||||
Inside your nested `for` loop, add a `console.log()` call to check the values of `array`, `array[j]`, and `array[minIndex]` at each iteration. You can click the `Sort` button to see how your algorithm is traversing the array.
|
||||
Dentro do laço `for` aninhado, adicione uma chamada a `console.log()` para verificar os valores de `array`, `array[j]` e `array[minIndex]` a cada iteração. Você pode clicar no botão `Sort` para ver como o algoritmo está percorrendo o array.
|
||||
|
||||
Then write an `if` statement that checks if the value at `j` is smaller than the value at `minIndex`. If it is, set `minIndex` to `j`.
|
||||
Em seguida, escreva uma instrução `if`, que verifica se o valor em `j` é menor do que o valor em `minIndex`. Se for, defina `minIndex` como `j`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should have a `console.log()` call inside your nested `for` loop.
|
||||
Você deve ter uma chamada a `console.log()` dentro do laço `for` aninhado.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(/);
|
||||
```
|
||||
|
||||
You should pass `array` as the first argument to `console.log()`.
|
||||
Você deve passar `array` como o primeiro argumento para `console.log()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,/);
|
||||
```
|
||||
|
||||
You should pass `array[j]` as the second argument to `console.log()`.
|
||||
Você deve passar `array[j]` como o segundo argumento para `console.log()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,/);
|
||||
```
|
||||
|
||||
You should pass `array[minIndex]` as the third argument to `console.log()`.
|
||||
Você deve passar `array[minIndex]` como o terceiro argumento para `console.log()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);?/);
|
||||
```
|
||||
|
||||
You should have an `if` statement after your `console.log()` call.
|
||||
Você deve ter uma instrução `if` após a chamada de `console.log()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);?\s*if\s*\(?/);
|
||||
```
|
||||
|
||||
You should have a condition in your `if` statement that checks if `array[j]` is less than `array[minIndex]`.
|
||||
Você deve ter uma nova condição na instrução `if` que verifica se `array[j]` é menor que `array[minIndex]`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{?/);
|
||||
```
|
||||
|
||||
Your `if` statement should set `minIndex` to `j`.
|
||||
A instrução `if` deve definir `minIndex` como `j`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}/);
|
||||
|
||||
@@ -7,31 +7,31 @@ dashedName: step-27
|
||||
|
||||
# --description--
|
||||
|
||||
After your nested `for` loop, you've found the smallest value. You need to swap it with your current value.
|
||||
Após o laço `for` aninhado, você terá encontrado o menor valor. Você precisa trocá-lo pelo valor atual.
|
||||
|
||||
Like you did in your bubble sort, use a `temp` variable to extract the value at `i`, then swap the values at `i` and `minIndex`.
|
||||
Como você fez na ordenação de bolha, use uma variável `temp` para extrair o valor de `i` e, então, troque os valores de `i` e de `minIndex`.
|
||||
|
||||
# --hints--
|
||||
|
||||
After your nested `for` loop, you should declare a `temp` variable.
|
||||
Após o laço `for`, aninhado você deve declarar uma variável `temp`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s*temp\s*=/);
|
||||
```
|
||||
|
||||
You should assign `array[i]` to `temp`.
|
||||
Você deve atribuir a `array[i]` o valor de `temp`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s*temp\s*=\s*array\[i\]/)
|
||||
```
|
||||
|
||||
You should assign `array[minIndex]` to `array[i]`.
|
||||
Você deve atribuir a `array[minIndex]` o valor de `array[i]`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s*temp\s*=\s*array\[i\]\s*;?\s*array\[i\]\s*=\s*array\[minIndex\]/)
|
||||
```
|
||||
|
||||
You should assign `temp` to `array[minIndex]`.
|
||||
Você deve atribuir a `temp` o valor de `array[minIndex]`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+selectionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s*minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s*temp\s*=\s*array\[i\]\s*;?\s*array\[i\]\s*=\s*array\[minIndex\]\s*;?\s*array\[minIndex\]\s*=\s*temp\s*;?\s*}/)
|
||||
|
||||
@@ -7,11 +7,11 @@ dashedName: step-29
|
||||
|
||||
# --description--
|
||||
|
||||
With your selection sort now functional, remove your `console.log()` statement.
|
||||
Com a ordenação de seleção funcional, remova a declaração de `console.log()`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should remove the `console.log()` statement from `selectionSort()`.
|
||||
Você deve remover a instrução `console.log()` de `selectionSort()`.
|
||||
|
||||
```js
|
||||
// Thanks loop-protect
|
||||
|
||||
@@ -7,35 +7,35 @@ dashedName: step-32
|
||||
|
||||
# --description--
|
||||
|
||||
An insertion sort algorithm starts the sort at the beginning of the list, meaning the first element is already sorted. With this in mind, create a `for` loop that starts at the second element in the array - it should still iterate through the rest of the array.
|
||||
Um algoritmo de ordenação de inserção inicia a ordenação no início da lista, o que significa que o primeiro elemento já está ordenado. Com isto em mente, crie um laço `for` que começa no segundo elemento do array – ele ainda deve percorrer o resto do array.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use a `for` loop to iterate through the array.
|
||||
Você deve usar um laço `for` para percorrer o array.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(/);
|
||||
```
|
||||
|
||||
Your `for` loop should initialize `i` at `1`.
|
||||
O laço `for` deve inicializar `i` em `1`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*/);
|
||||
```
|
||||
|
||||
Your `for` loop should have a condition that checks the value of `i` is less than the length of the array.
|
||||
O laço `for` deve ter uma condição que verifica se o valor de `i` é menor do que o comprimento do array.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*/);
|
||||
```
|
||||
|
||||
Your `for` loop should increment `i` by `1` each time it runs.
|
||||
O laço `for` deve incrementar `i` em `1` a cada vez que é executado.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*/);
|
||||
```
|
||||
|
||||
Your `for` loop should be empty.
|
||||
O laço `for` deve estar vazio.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*}\s*}/);
|
||||
|
||||
@@ -7,29 +7,29 @@ dashedName: step-33
|
||||
|
||||
# --description--
|
||||
|
||||
Declare a `currValue` variable and assign it the value at `i`. Then, declare a `j` variable and assign it `i - 1`. Your `j` variable should be re-assignable.
|
||||
Declare uma variável `currValue` e atribua a ela o valor em `i`. Em seguida, declare uma variável `j` e atribua a ela `i - 1`. A variável `j` deve ser atribuível novamente.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should declare a `currValue` variable with `const`.
|
||||
Você deve declarar uma variável `currValue` com `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=/);
|
||||
```
|
||||
|
||||
You should assign `currValue` the value at `i`.
|
||||
Você deve atribuir a `currValue` o valor de `i`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?/);
|
||||
```
|
||||
|
||||
You should declare a `j` variable with `let`.
|
||||
Você deve declarar uma variável `j` com `let`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=/);
|
||||
```
|
||||
|
||||
You should assign `j` the value of `i - 1`.
|
||||
Você deve atribuir a `j` o valor de `i - 1`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?/);
|
||||
|
||||
@@ -7,40 +7,40 @@ dashedName: step-34
|
||||
|
||||
# --description--
|
||||
|
||||
For this algorithm, you'll want to use a `while` loop. This loop needs two conditions:
|
||||
Para esse algoritmo, você vai querer usar um laço `while`. Esse laço precisa de duas condições:
|
||||
|
||||
- First, it should not run beyond the beginning of the array (accessed with `j`).
|
||||
- Second, the loop should not run after it finds a value smaller than the current value.
|
||||
- Primeiro, ele não deve ser executado além do início do array (acessado com `j`).
|
||||
- Em segundo lugar, o laço não deve ser executado depois de encontrar um valor menor que o valor atual.
|
||||
|
||||
To prevent an infinite loop, decrement `j` inside your loop.
|
||||
Para evitar um loop infinito, decremente `j` dentro do laço.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use a `while` loop.
|
||||
Você deve usar um laço `while`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(/);
|
||||
```
|
||||
|
||||
Your `while` loop should have its first condition that checks the value of `j` is greater than or equal to `0`.
|
||||
O laço `while` deve ter uma primeira condição que verifica se o valor de `j` é maior do que ou igual a `0`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0/);
|
||||
```
|
||||
|
||||
Your `while` loop should use the AND operator.
|
||||
O laço `while` deve usar o operador AND.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&/);
|
||||
```
|
||||
|
||||
Your `while` loop should have a condition that checks the value of `array[j]` is greater than `currValue`.
|
||||
O laço `while` deve ter uma condição que verifica se o valor de `array[j]` é maior do que `currValue`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)/);
|
||||
```
|
||||
|
||||
Your `while` loop should decrement `j` inside the loop.
|
||||
O laço `while` deve decrementar `j` dentro do laço.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s*currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s*j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*j--;?\s*\}/);
|
||||
|
||||
@@ -7,23 +7,23 @@ dashedName: step-38
|
||||
|
||||
# --description--
|
||||
|
||||
To sort the elements of an array, you can use the built-in method called `.sort()`. Therefore, you can update the `sortedValues` variable by assigning it the result of calling `.sort()` on the `inputValues` array.
|
||||
Para ordenar os elementos de um array, você pode usar o método integrado chamado `.sort()`. Portanto, você pode atualizar a variável `sortedValues`, atribuindo a ela o resultado da chamada de `.sort()` no array `inputValues`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should update your `sortedValues` variable to be the result of calling the `.sort()` method on your `inputValues` array.
|
||||
Você deve atualizar a variável `sortedValues` para que seja o resultado da chamada do método `.sort()` no array `inputValues`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(/);
|
||||
```
|
||||
|
||||
You should not pass anything into the `.sort()` method.
|
||||
Você não deve passar nada para o método `.sort()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\)/);
|
||||
```
|
||||
|
||||
You should not call `selectionSort` in your code.
|
||||
Você não deve chamar `selectionSort` no código.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /selectionSort\s*\(/);
|
||||
|
||||
@@ -7,13 +7,13 @@ dashedName: step-42
|
||||
|
||||
# --description--
|
||||
|
||||
If you press the `Sort` button again, you should see that `10` is now in the correct position of the `Output`.
|
||||
Se você pressionar o botão `Sort` novamente, deve ver que `10` está agora na posição correta do `Output`.
|
||||
|
||||
To finish this project, change your `option` back to a `value` and text of `1`.
|
||||
Para concluir este projeto, mude sua `option` de volta para um `value` e um texto de `1`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should update the `value` of the `option` element that is `selected` to `1`.
|
||||
Você deve atualizar `value` do elemento `option` que tem como atributo `selected` para `1`.
|
||||
|
||||
```js
|
||||
const values = document.querySelectorAll('.values-dropdown')?.[3];
|
||||
@@ -21,7 +21,7 @@ const option = values.querySelector('option[selected]');
|
||||
assert.equal(option?.value, '1');
|
||||
```
|
||||
|
||||
You should update the text of the `option` element that is `selected` to `1`.
|
||||
Você deve atualizar o texto do elemento `option` que tem como atributo `selected` para `1`.
|
||||
|
||||
```js
|
||||
const values = document.querySelectorAll('.values-dropdown')?.[3];
|
||||
|
||||
@@ -51,6 +51,12 @@ assert(gloveBoxContents === 'maps');
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
```
|
||||
|
||||
`gloveBoxContents` should still be declared with `const`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+gloveBoxContents\s*=/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
@@ -18,7 +18,7 @@ Font Awesome - це зручна бібліотека іконок. Іконки
|
||||
|
||||
Використовуйте Font Awesome, щоб додати іконку `info-circle` до кнопки "Інформація" та іконку `trash` до кнопки "Видалити".
|
||||
|
||||
**Примітка:** Елемент `span` є допустимою альтернативою елемента `i` для вказівок нижче.
|
||||
**Note:** You can use either `i` or `span` elements to complete this challenge.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user