lette
Esempio:
```js
-var anAdjective = "awesome!";
-var ourStr = "freeCodeCamp is ";
+const anAdjective = "awesome!";
+let ourStr = "freeCodeCamp is ";
ourStr += anAdjective;
```
@@ -64,15 +64,14 @@ assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
```js
// Change code below this line
-
-var someAdjective;
-var myStr = "Learning to code is ";
+const someAdjective = "";
+let myStr = "Learning to code is ";
```
# --solutions--
```js
-var someAdjective = "neat";
-var myStr = "Learning to code is ";
+const someAdjective = "neat";
+let myStr = "Learning to code is ";
myStr += someAdjective;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
index 7f5495e0fe..4a410f6d46 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
@@ -49,13 +49,14 @@ assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code));
```js
// Setup
-var processed = 0;
+let processed = 0;
function processArg(num) {
return (num + 3) / 5;
}
// Only change code below this line
+
```
# --solutions--
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
index 7c2e39e0c5..2bc4084a84 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
@@ -18,7 +18,7 @@ Gli oggetti sono utili per archiviare i dati in modo strutturato e possono rappr
Ecco un esempio di oggetto gatto (cat):
```js
-var cat = {
+const cat = {
"name": "Whiskers",
"legs": 4,
"tails": 1,
@@ -29,7 +29,7 @@ var cat = {
In questo esempio, tutte le proprietà sono memorizzate come stringhe, come `name`, `legs`e `tails`. Per le proprietà puoi anche usare i numeri. Puoi anche omettere le virgolette per le proprietà di tipo stringa di una sola parola, come segue:
```js
-var anotherObject = {
+const anotherObject = {
make: "Ford",
5: "five",
"model": "focus"
@@ -139,18 +139,18 @@ assert(
## --seed-contents--
```js
-var myDog = {
-// Only change code below this line
+const myDog = {
+ // Only change code below this line
-// Only change code above this line
+ // Only change code above this line
};
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
index c9c1eb08d1..9751c1dc03 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
@@ -16,7 +16,7 @@ L'operatore di base è l'operatore di uguaglianza `==`. L'operatore di uguaglian
```js
function equalityTest(myVal) {
if (myVal == 10) {
- return "Equal";
+ return "Equal";
}
return "Not Equal";
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
index 048161809c..7b8c7ea317 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
@@ -25,7 +25,7 @@ Nell'ordine, queste espressioni saranno valutate `true`, `false`, `false`, `fals
# --instructions--
-Aggiungi l'operatore di disuguaglianza `!=` nell'istruzione `if` in modo che la funzione restituisca la stringa `Not Equal` quando `val` non equivale a `99`
+Aggiungi l'operatore di disuguaglianza `!=` nella condizione dell' `if` in modo che la funzione restituisca la stringa `Not Equal` quando `val` non equivale a `99`.
# --hints--
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
index eac103167e..3107758b4d 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
@@ -26,7 +26,7 @@ Nel secondo esempio, `3` è un tipo `Number` e `'3'` è un tipo `String`.
# --instructions--
-Usa l'operatore di uguaglianza stretta nell'istruzione `if` in modo che la funzione restituisca la stringa `Equal` quando `val` è strettamente uguale a `7`
+Usa l'operatore di uguaglianza stretta nella condizione dell'`if` in modo che la funzione restituisca la stringa `Equal` quando `val` è strettamente uguale a `7`.
# --hints--
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
index 3a7516605f..4549ea2628 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
@@ -20,7 +20,7 @@ per aggiungere `5` a `myVar`. Poiché questo è uno scherma molto comune, ci son
Uno di questi operatori è l'operatore `+=`.
```js
-var myVar = 1;
+let myVar = 1;
myVar += 5;
console.log(myVar);
```
@@ -61,9 +61,9 @@ Non dovresti modificare il codice sopra il commento specificato.
```js
assert(
- /var a = 3;/.test(code) &&
- /var b = 17;/.test(code) &&
- /var c = 12;/.test(code)
+ /let a = 3;/.test(code) &&
+ /let b = 17;/.test(code) &&
+ /let c = 12;/.test(code)
);
```
@@ -78,9 +78,9 @@ assert(
## --seed-contents--
```js
-var a = 3;
-var b = 17;
-var c = 12;
+let a = 3;
+let b = 17;
+let c = 12;
// Only change code below this line
a = a + 12;
@@ -91,9 +91,9 @@ c = c + 7;
# --solutions--
```js
-var a = 3;
-var b = 17;
-var c = 12;
+let a = 3;
+let b = 17;
+let c = 12;
a += 12;
b += 9;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
index b14acf94bf..446a9a9564 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
@@ -55,9 +55,9 @@ Non dovresti modificare il codice sopra il commento specificato.
```js
assert(
- /var a = 48;/.test(code) &&
- /var b = 108;/.test(code) &&
- /var c = 33;/.test(code)
+ /let a = 48;/.test(code) &&
+ /let b = 108;/.test(code) &&
+ /let c = 33;/.test(code)
);
```
@@ -72,9 +72,9 @@ assert(
## --seed-contents--
```js
-var a = 48;
-var b = 108;
-var c = 33;
+let a = 48;
+let b = 108;
+let c = 33;
// Only change code below this line
a = a / 12;
@@ -85,9 +85,9 @@ c = c / 11;
# --solutions--
```js
-var a = 48;
-var b = 108;
-var c = 33;
+let a = 48;
+let b = 108;
+let c = 33;
a /= 12;
b /= 4;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
index 6ba1434e32..5229214cda 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
@@ -55,9 +55,9 @@ Non dovresti modificare il codice sopra il commento specificato.
```js
assert(
- /var a = 5;/.test(code) &&
- /var b = 12;/.test(code) &&
- /var c = 4\.6;/.test(code)
+ /let a = 5;/.test(code) &&
+ /let b = 12;/.test(code) &&
+ /let c = 4\.6;/.test(code)
);
```
@@ -72,9 +72,9 @@ assert(
## --seed-contents--
```js
-var a = 5;
-var b = 12;
-var c = 4.6;
+let a = 5;
+let b = 12;
+let c = 4.6;
// Only change code below this line
a = a * 5;
@@ -85,9 +85,9 @@ c = c * 10;
# --solutions--
```js
-var a = 5;
-var b = 12;
-var c = 4.6;
+let a = 5;
+let b = 12;
+let c = 4.6;
a *= 5;
b *= 3;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
index 37aaeb515a..9604a3105b 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
@@ -55,7 +55,7 @@ Non dovresti modificare il codice sopra il commento specificato.
```js
assert(
- /var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code)
+ /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code)
);
```
@@ -70,9 +70,9 @@ assert(
## --seed-contents--
```js
-var a = 11;
-var b = 9;
-var c = 3;
+let a = 11;
+let b = 9;
+let c = 3;
// Only change code below this line
a = a - 6;
@@ -83,9 +83,9 @@ c = c - 1;
# --solutions--
```js
-var a = 11;
-var b = 9;
-var c = 3;
+let a = 11;
+let b = 9;
+let c = 3;
a -= 6;
b -= 15;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
index 022391c2fa..4d892a62d2 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
@@ -22,7 +22,7 @@ In JavaScript, quando l'operatore `+` viene usato con un valore di tipo `String`
Esempio:
```js
-var ourStr = "I come first. " + "I come second.";
+const ourStr = "I come first. " + "I come second.";
```
La stringa `I come first. I come second.` sarebbe visualizzata nella console.
@@ -44,10 +44,10 @@ Dovresti usare l'operatore `+` per costruire `myStr`.
assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g));
```
-`myStr` dovrebbe essere creato usando la parola chiave `var`.
+`myStr` dovrebbe essere creato usando la parola chiave `const`.
```js
-assert(/var\s+myStr/.test(code));
+assert(/const\s+myStr/.test(code));
```
Dovresti assegnare il risultato alla variabile `myStr`.
@@ -73,11 +73,11 @@ assert(/myStr\s*=/.test(code));
## --seed-contents--
```js
-var myStr; // Change this line
+const myStr = ""; // Change this line
```
# --solutions--
```js
-var myStr = "This is the start. " + "This is the end.";
+const myStr = "This is the start. " + "This is the end.";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
index b8676edf8b..9dbaaec167 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
@@ -16,7 +16,7 @@ Possiamo anche usare l'operatore `+=` per concatenare una stringa all
Esempio:
```js
-var ourStr = "I come first. ";
+let ourStr = "I come first. ";
ourStr += "I come second.";
```
@@ -57,14 +57,12 @@ assert(code.match(/myStr\s*\+=\s*(["']).*\1/g));
## --seed-contents--
```js
-// Only change code below this line
-
-var myStr;
+let myStr;
```
# --solutions--
```js
-var myStr = "This is the first sentence. ";
+let myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
index 809fc93be2..464e2e5b56 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
@@ -14,8 +14,8 @@ A volte dovrai costruire una stringa, nello stile di [Mad Libs](https://en.wikip
Esempio:
```js
-var ourName = "freeCodeCamp";
-var ourStr = "Hello, our name is " + ourName + ", how are you?";
+const ourName = "freeCodeCamp";
+const ourStr = "Hello, our name is " + ourName + ", how are you?";
```
`ourStr` avrà un valore stringa `Hello, our name is freeCodeCamp, how are you?`.
@@ -63,13 +63,13 @@ assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
```js
// Only change code below this line
-var myName;
-var myStr;
+const myName = "";
+const myStr = "";
```
# --solutions--
```js
-var myName = "Bob";
-var myStr = "My name is " + myName + " and I am well!";
+const myName = "Bob";
+const myStr = "My name is " + myName + " and I am well!";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
index 34f024419b..fb9839f603 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
@@ -16,13 +16,14 @@ Per decrementare di due ad ogni iterazione, dovremo cambiare la nostra inizializ
Inizieremo da `i = 10` e ripeteremo finché `i > 0`. Diminuiremo `i` di 2 ad ogni ciclo con `i -= 2`.
```js
-var ourArray = [];
-for (var i = 10; i > 0; i -= 2) {
+const ourArray = [];
+
+for (let i = 10; i > 0; i -= 2) {
ourArray.push(i);
}
```
-`ourArray` adesso conterrà `[10,8,6,4,2]`. Cambiamo la nostra inizializzazione e espressione finale in modo da poter contare indietro di due per creare un array di numeri dispari discendenti.
+`ourArray` adesso conterrà `[10, 8, 6, 4, 2]`. Cambiamo la nostra inizializzazione e espressione finale in modo da poter contare indietro di due per creare un array di numeri dispari discendenti.
# --instructions--
@@ -42,7 +43,7 @@ Dovresti usare il metodo array `push`.
assert(code.match(/myArray.push/));
```
-`myArray` dovrebbe essere uguale a `[9,7,5,3,1]`.
+`myArray` dovrebbe essere uguale a `[9, 7, 5, 3, 1]`.
```js
assert.deepEqual(myArray, [9, 7, 5, 3, 1]);
@@ -60,16 +61,17 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
+const myArray = [];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [];
-for (var i = 9; i > 0; i -= 2) {
+const myArray = [];
+for (let i = 9; i > 0; i -= 2) {
myArray.push(i);
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
index cf0e722a4b..2b77d02d98 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
@@ -159,7 +159,7 @@ assert(
## --seed-contents--
```js
-var count = 0;
+let count = 0;
function cc(card) {
// Only change code below this line
@@ -175,7 +175,7 @@ cc(2); cc(3); cc(7); cc('K'); cc('A');
# --solutions--
```js
-var count = 0;
+let count = 0;
function cc(card) {
switch(card) {
case 2:
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
index 936dfa0527..8e3efadda9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
@@ -42,13 +42,14 @@ assert(myDecimal % 1 != 0);
## --seed-contents--
```js
-var ourDecimal = 5.7;
+const ourDecimal = 5.7;
// Only change code below this line
+
```
# --solutions--
```js
-var myDecimal = 9.9;
+const myDecimal = 9.9;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md
index cca667f914..4144ea4cec 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md
@@ -10,7 +10,7 @@ dashedName: declare-a-read-only-variable-with-the-const-keyword
La parola chiave `let` non è l'unico nuovo modo per dichiarare le variabili. In ES6, puoi anche dichiarare variabili usando la parola chiave `const`.
-`const` ha tutte le fantastiche caratteristiche che ha `let`, con il il valore aggiunto che le variabili dichiarate utilizzando `const` sono di sola lettura. Esse sono un valore costante, il che significa che una volta assegnata una variabile con `const`, non può più essere riassegnata.
+`const` ha tutte le fantastiche caratteristiche che ha `let`, con il il valore aggiunto che le variabili dichiarate utilizzando `const` sono di sola lettura. Esse sono un valore costante, il che significa che una volta assegnata una variabile con `const`, non può più essere riassegnata:
```js
const FAV_PET = "Cats";
@@ -19,9 +19,11 @@ FAV_PET = "Dogs";
La console mostrerà un errore a causa della riassegnazione del valore di `FAV_PET`.
-Come puoi vedere, cercare di riassegnare una variabile dichiarata con `const` genererà un errore. Dovresti sempre dichiarare le variabili che non vuoi riassegnare usando la parola chiave `const`. Questo aiuta quando nel caso dovessi tentare accidentalmente di riassegnare il valore a una variabile che è destinata a rimanere costante. Una pratica comune quando si dà il nome alle costanti è usare tutte le lettere maiuscole, separando le parole con un underscore.
+Dovresti sempre dichiarare le variabili che non vuoi riassegnare usando la parola chiave `const`. Questo aiuta quando nel caso dovessi tentare accidentalmente di riassegnare il valore a una variabile che è destinata a rimanere costante.
-**Nota:** È pratica comune per gli sviluppatori usare identificatori di variabili a lettere maiuscole per valori immutabili e a lettere minuscole o camelCase per valori mutabili (oggetti e array). In una sfida successiva vedrai un esempio di identificatore di variabile con lettere minuscole utilizzato per un array.
+Una pratica comune quando si dà il nome alle costanti è usare tutte le lettere maiuscole, separando le parole con un underscore.
+
+**Nota:** È pratica comune per gli sviluppatori usare identificatori di variabili a lettere maiuscole per valori immutabili e a lettere minuscole o camelCase per valori mutabili (oggetti e array). Imparerai di più su oggetti, array, e valori mutabili e immutabili in sfide future. In sfide future vedrai esempi di identificatori di variavile in maiuscolo, minuscolo e camelCase.
# --instructions--
@@ -35,23 +37,33 @@ Modifica il codice in modo che tutte le variabili siano dichiarate utilizzando `
(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-`SENTENCE` dovrebbe essere una variabile costante dichiarata con `const`.
+Dovresti cambiare `fCC` a solo maiuscole.
```js
-(getUserInput) => assert(getUserInput('index').match(/(const SENTENCE)/g));
+(getUserInput) => {
+ assert(getUserInput('index').match(/(FCC)/));
+ assert(!getUserInput('index').match(/fCC/));
+}
```
-`i` dovrebbe essere dichiarata con `let`.
+`FCC` dovrebbe essere una variabile costante dichiarata con `const`.
```js
-(getUserInput) => assert(getUserInput('index').match(/(let i)/g));
+assert.equal(FCC, 'freeCodeCamp');
+assert.match(code, /const\s+FCC/);
```
-`console.log` dovrebbe essere cambiato per stampare la variabile `SENTENCE`.
+`fact` dovrebbe essere dichiarata con `let`.
+
+```js
+(getUserInput) => assert(getUserInput('index').match(/(let fact)/g));
+```
+
+`console.log` dovrebbe essere cambiato in modo da stampare le variabili `FCC` e `fact`.
```js
(getUserInput) =>
- assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g));
+ assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
```
# --seed--
@@ -59,31 +71,21 @@ Modifica il codice in modo che tutte le variabili siano dichiarate utilizzando `
## --seed-contents--
```js
-function printManyTimes(str) {
+// Only change code below this line
+var fCC = "freeCodeCamp";
+var fact = "is cool!";
+// Only change code above this line
- // Only change code below this line
-
- var sentence = str + " is cool!";
- for (var i = 0; i < str.length; i+=2) {
- console.log(sentence);
- }
-
- // Only change code above this line
-
-}
-printManyTimes("freeCodeCamp");
+fact = "is awesome!";
+console.log(fCC, fact);
```
# --solutions--
```js
-function printManyTimes(str) {
+const FCC = "freeCodeCamp";
+let fact = "is cool!";
- const SENTENCE = str + " is cool!";
- for (let i = 0; i < str.length; i+=2) {
- console.log(SENTENCE);
- }
-
-}
-printManyTimes("freeCodeCamp");
+fact = "is awesome!";
+console.log(FCC, fact);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
index 93851155f1..21013359bc 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
@@ -9,13 +9,19 @@ dashedName: declare-string-variables
# --description--
-Precedentemente abbiamo usato il codice
+In precedenza hai usato il seguente codice per dichiarare una variabile:
+
+```js
+var myName;
+```
+
+Ma puoi anche dichiarare una variabile con valore stringa in questo modo:
```js
var myName = "your name";
```
-`"your name"` è chiamato una stringa letterale. È una stringa perché è una serie di zero o più caratteri racchiusi in virgolette singole o doppie.
+`"your name"` è chiamato una stringa letterale. Una stringa letterale, o stringa, è una serie di zero o più caratteri racchiusi in virgolette singole o doppie.
# --instructions--
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
index 0c04704652..75bd853e1f 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
@@ -39,7 +39,7 @@ assert(myVar === 10);
```js
assert(
- /var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
+ /let\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
);
```
@@ -52,7 +52,7 @@ assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
Non dovresti modificare il codice sopra il commento specificato.
```js
-assert(/var myVar = 11;/.test(code));
+assert(/let myVar = 11;/.test(code));
```
# --seed--
@@ -66,7 +66,7 @@ assert(/var myVar = 11;/.test(code));
## --seed-contents--
```js
-var myVar = 11;
+let myVar = 11;
// Only change code below this line
myVar = myVar - 1;
@@ -75,6 +75,6 @@ myVar = myVar - 1;
# --solutions--
```js
-var myVar = 11;
+let myVar = 11;
myVar--;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
index 01b03808be..1ab4e1e7ad 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
@@ -18,7 +18,7 @@ delete ourDog.bark;
Esempio:
```js
-var ourDog = {
+const ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
@@ -70,7 +70,7 @@ assert(code.match(/"tails": 1/g).length > 0);
```js
// Setup
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
@@ -79,12 +79,13 @@ var myDog = {
};
// Only change code below this line
+
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
index 1cca4be92d..ad30fcc1a9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
@@ -46,11 +46,11 @@ assert(code.match(/quotient/g).length === 1);
## --seed-contents--
```js
-var quotient = 0.0 / 2.0; // Change this line
+const quotient = 0.0 / 2.0; // Change this line
```
# --solutions--
```js
-var quotient = 4.4 / 2.0;
+const quotient = 4.4 / 2.0;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
index 0240fb3111..0739cc32c2 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript utilizza il simbolo `/` per la divisione.
**Esempio**
```js
-myVar = 16 / 2;
+const myVar = 16 / 2;
```
`myVar` ora ha il valore `8`.
@@ -49,11 +49,11 @@ assert(/\d+\s*\/\s*\d+/.test(code));
## --seed-contents--
```js
-var quotient = 66 / 0;
+const quotient = 66 / 0;
```
# --solutions--
```js
-var quotient = 66 / 33;
+const quotient = 66 / 33;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
index 98b4514870..17aad98a65 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
@@ -89,11 +89,11 @@ console.log('myStr:\n' + myStr);}})();
## --seed-contents--
```js
-var myStr; // Change this line
+const myStr = ""; // Change this line
```
# --solutions--
```js
-var myStr = "FirstLine\n\t\\SecondLine\nThirdLine";
+const myStr = "FirstLine\n\t\\SecondLine\nThirdLine";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
index 8a7022ecf3..40fc3c2823 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
@@ -14,7 +14,7 @@ Quando definisci una stringa devi cominciare e finire con una virgoletta singola
In JavaScript, puoi fare l'escape di una virgoletta per distinguerla da quella usata per terminare la stringa posizionando una barra rovesciata (`\`) davanti alla virgoletta.
```js
-var sampleStr = "Alan said, \"Peter is learning JavaScript\".";
+const sampleStr = "Alan said, \"Peter is learning JavaScript\".";
```
Questo segnala a JavaScript che la virgoletta seguente non è la fine della stringa, ma dovrebbe invece apparire dentro la stringa. Quindi se dovessi farla visualizzare nella console, otterresti:
@@ -62,11 +62,11 @@ assert(/I am a "double quoted" string inside "double quotes(\."|"\.)$/.test(mySt
## --seed-contents--
```js
-var myStr = ""; // Change this line
+const myStr = ""; // Change this line
```
# --solutions--
```js
-var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
+const myStr = "I am a \"double quoted\" string inside \"double quotes\".";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md
index 9e5a126c03..bc3fff3b86 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md
@@ -8,32 +8,30 @@ dashedName: explore-differences-between-the-var-and-let-keywords
# --description--
-Uno dei maggiori problemi quando si dichiarano delle variabili con la parola chiave `var` è che è possibile sovrascrivere le dichiarazioni delle variabili senza errori.
+Uno dei maggiori problemi quando si dichiarano delle variabili con la parola chiave `var` è che è possibile sovrascrivere facilmente le dichiarazioni delle variabili:
```js
-var camper = 'James';
-var camper = 'David';
+var camper = "James";
+var camper = "David";
console.log(camper);
```
-Qui la console mostrerà la stringa `David`.
+Nel codice qui sopra, la variabile `camper` è originariamente dichiarata come `James` per poi essere sovrascritta con `David`. La console poi mostra la stringa `David`.
-Come puoi vedere nel codice qui sopra, la variabile `camper` è originariamente dichiarata come `James` per poi essere sovrascritta con `David`. In una piccola applicazione si potrebbe non incorrere in questo tipo di problema, ma quando il codice diventa più grande, potresti accidentalmente sovrascrivere una variabile che non hai intenzione di sovrascrivere. Poiché questo comportamento non lancia un errore, la ricerca e la correzione di bug diventa più difficile.
-Una nuova parola chiave, chiamata `let`, è stata introdotta in ES6 per risolvere questo potenziale problema con la parola chiave `var`. Se dovessi sostituire `var` con `let` nelle dichiarazioni delle variabili nel codice sopra, il risultato sarebbe un errore.
+In una piccola applicazione, potresti non incorrere in questo tipo di problema. Ma man mano che il tuo codebase diventa più grande potresti accidentalmente sovrascrivere una variabile che non intendevi sovrascrivere. Poiché questo comportamento non da errore, cercare e sistemare bug diventa più difficile.
+
+Una parola chiave chiamata `let` è stata introdotta in ES6, un aggiornamento importante a JavaScript, per risolvere questo potenziale problema con la parola chiave `var`. Imparerai altre caratteristiche di ES6 in sfide future.
+
+Se sostituisci `var` con `let` nel codice qua sopra, risulta in un errore:
```js
-let camper = 'James';
-let camper = 'David';
+let camper = "James";
+let camper = "David";
```
-Questo errore può essere visto nella console del tuo browser. Quindi, a differenza di `var`, quando si utilizza `let`, una variabile con lo stesso nome può essere dichiarata solo una volta. Nota l'`"use strict"`. Questo abilita la Strict Mode (Modalità Rigorosa), che cattura gli errori di codifica comuni e le azioni "non sicure". Per esempio:
+L'errore può essere visto nella console del browser.
-```js
-"use strict";
-x = 3.14;
-```
-
-Questo mostrerà l'errore `x is not defined`.
+Quindi a differenza di `var`, wuando usi `let`, una variabile con lo stesso nome può essere dichiarata una sola volta.
# --instructions--
@@ -53,10 +51,10 @@ Aggiorna il codice in modo che utilizzi solo la parola chiave `let`.
assert(catName === 'Oliver');
```
-`quote` dovrebbe essere uguale alla stringa `Oliver says Meow!`
+`catSound` dovrebbe essere uguale alla stringa `Meow!`
```js
-assert(quote === 'Oliver says Meow!');
+assert(catSound === 'Meow!');
```
# --seed--
@@ -64,28 +62,13 @@ assert(quote === 'Oliver says Meow!');
## --seed-contents--
```js
-var catName;
-var quote;
-function catTalk() {
- "use strict";
-
- catName = "Oliver";
- quote = catName + " says Meow!";
-
-}
-catTalk();
+var catName = "Oliver";
+var catSound = "Meow!";
```
# --solutions--
```js
-let catName;
-let quote;
-function catTalk() {
- 'use strict';
-
- catName = 'Oliver';
- quote = catName + ' says Meow!';
-}
-catTalk();
+let catName = "Oliver";
+let catSound = "Meow!";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
index ccfc058a17..e590f6893d 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
@@ -17,7 +17,7 @@ console.log("Alan Peter".length);
Il valore `10` sarà visualizzato nella console.
-Ad esempio, se avessimo creato una variabile `var firstName = "Ada"`, potremmo scoprire quanto è lunga la stringa `Ada` utilizzando la proprietà `firstName.length`.
+Ad esempio, se avessimo creato una variabile `const firstName = "Ada"`, potremmo scoprire quanto è lunga la stringa `Ada` utilizzando la proprietà `firstName.length`.
# --instructions--
@@ -29,8 +29,8 @@ Non dovresti cambiare le dichiarazioni della variabile nella sezione `// Setup`.
```js
assert(
- code.match(/var lastNameLength = 0;/) &&
- code.match(/var lastName = "Lovelace";/)
+ code.match(/let lastNameLength = 0;/) &&
+ code.match(/const lastName = "Lovelace";/)
);
```
@@ -52,18 +52,17 @@ assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
```js
// Setup
-var lastNameLength = 0;
-var lastName = "Lovelace";
+let lastNameLength = 0;
+const lastName = "Lovelace";
// Only change code below this line
-
lastNameLength = lastName;
```
# --solutions--
```js
-var lastNameLength = 0;
-var lastName = "Lovelace";
+let lastNameLength = 0;
+const lastName = "Lovelace";
lastNameLength = lastName.length;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
index 5640d2122b..5985a29924 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
@@ -31,7 +31,7 @@ Imposta `remainder` pari al resto di `11` diviso per `3` utilizzando l'operatore
La variabile `remainder` dovrebbe essere inizializzata
```js
-assert(/var\s+?remainder/.test(code));
+assert(/(const|let|var)\s+?remainder/.test(code));
```
Il valore di `remainder` dovrebbe essere `2`
@@ -57,13 +57,11 @@ assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
## --seed-contents--
```js
-// Only change code below this line
-
-var remainder;
+const remainder = 0;
```
# --solutions--
```js
-var remainder = 11 % 3;
+const remainder = 11 % 3;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
index 499da827e0..e662de1aad 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
@@ -11,13 +11,13 @@ dashedName: global-scope-and-functions
In JavaScript, lo scope (campo di applicazione o ambito di visibilità) si riferisce alla visibilità delle variabili. Le variabili che sono definite al di fuori del blocco di una funzione hanno un campo di applicazione globale. Questo significa che possono essere viste ovunque nel tuo codice JavaScript.
-Le variabili che vengono dichiarate senza la parola chiave `var` vengono create automaticamente nell'ambito `global`. Questo può dare delle conseguenze indesiderate da un'altra parte nel tuo codice o quando si esegue nuovamente la funzione. Dovresti sempre dichiarare le tue variabili con `var`.
+Le variabili che vengono dichiarate senza la parola chiave `let` o la parola chiave `const` vengono create automaticamente nell'ambito `global`. Questo può dare delle conseguenze indesiderate da un'altra parte nel tuo codice o quando si esegue nuovamente la funzione. Dovresti sempre dichiarare le tue variabili con `let` o `const`.
# --instructions--
-Usando `var`, dichiara una variabile globale denominata `myGlobal` al di fuori di qualsiasi funzione. Inizializzala con un valore di `10`.
+Usando `let` o `const`, dichiara una variabile globale denominata `myGlobal` al di fuori di qualsiasi funzione. Inizializzala con un valore di `10`.
-All'interno della funzione `fun1`, assegna `5` a `oopsGlobal` ***senza*** utilizzare la parola chiave `var`.
+All'interno della funzione `fun1`, assegna `5` a `oopsGlobal` ***senza*** utilizzare le parole chiave `let` o `const`.
# --hints--
@@ -33,10 +33,10 @@ assert(typeof myGlobal != 'undefined');
assert(myGlobal === 10);
```
-`myGlobal` dovrebbe essere dichiarata usando la parola chiave `var`
+`myGlobal` dovrebbe essere dichiarata usando la parola chiave `let` o `const`
```js
-assert(/var\s+myGlobal/.test(code));
+assert(/(let|const)\s+myGlobal/.test(code));
```
`oopsGlobal` dovrebbe essere una variabile globale e avere un valore di `5`
@@ -109,7 +109,7 @@ function fun2() {
# --solutions--
```js
-var myGlobal = 10;
+const myGlobal = 10;
function fun1() {
oopsGlobal = 5;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
index 852c88daa2..40cedbbfd8 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
@@ -14,9 +14,10 @@ dashedName: global-vs--local-scope-in-functions
In questo esempio:
```js
-var someVar = "Hat";
+const someVar = "Hat";
+
function myFun() {
- var someVar = "Head";
+ const someVar = "Head";
return someVar;
}
```
@@ -53,13 +54,11 @@ assert(/return outerWear/.test(code));
```js
// Setup
-var outerWear = "T-Shirt";
+const outerWear = "T-Shirt";
function myOutfit() {
// Only change code below this line
-
-
// Only change code above this line
return outerWear;
}
@@ -70,9 +69,9 @@ myOutfit();
# --solutions--
```js
-var outerWear = "T-Shirt";
+const outerWear = "T-Shirt";
function myOutfit() {
- var outerWear = "sweater";
+ const outerWear = "sweater";
return outerWear;
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
index ba3b91c600..e74d90aead 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
@@ -90,7 +90,8 @@ assert(golfScore(5, 9) === 'Go Home!');
## --seed-contents--
```js
-var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
+const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
+
function golfScore(par, strokes) {
// Only change code below this line
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
index 8d0f9a7c1f..435b92ad32 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
@@ -39,7 +39,7 @@ Non dovresti utilizzare l'operatore di assegnazione.
```js
assert(
- /var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code)
+ /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code)
);
```
@@ -52,7 +52,7 @@ assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
Non dovresti cambiare il codice sopra il commento specificato.
```js
-assert(/var myVar = 87;/.test(code));
+assert(/let myVar = 87;/.test(code));
```
# --seed--
@@ -66,7 +66,7 @@ assert(/var myVar = 87;/.test(code));
## --seed-contents--
```js
-var myVar = 87;
+let myVar = 87;
// Only change code below this line
myVar = myVar + 1;
@@ -75,6 +75,6 @@ myVar = myVar + 1;
# --solutions--
```js
-var myVar = 87;
+let myVar = 87;
myVar++;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
index 5a725a78ec..640f3be83a 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
@@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5');
Non dovresti modificare il codice sopra o sotto i commenti specificati.
```js
-assert(/var result = "";/.test(code) && /return result;/.test(code));
+assert(/let result = "";/.test(code) && /return result;/.test(code));
```
# --seed--
@@ -73,7 +73,7 @@ assert(/var result = "";/.test(code) && /return result;/.test(code));
```js
function testElse(val) {
- var result = "";
+ let result = "";
// Only change code below this line
if (val > 5) {
@@ -95,7 +95,7 @@ testElse(4);
```js
function testElse(val) {
- var result = "";
+ let result = "";
if(val > 5) {
result = "Bigger than 5";
} else {
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
index 8da2578342..02f2ac569b 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
@@ -14,13 +14,14 @@ I cicli for non devono necessariamente iterare un numero alla volta. Modificando
Inizieremo da `i = 0` e ripeteremo il ciclo finché `i < 10`. Incrementeremo `i` di 2 ad ogni ciclo con `i += 2`.
```js
-var ourArray = [];
-for (var i = 0; i < 10; i += 2) {
+const ourArray = [];
+
+for (let i = 0; i < 10; i += 2) {
ourArray.push(i);
}
```
-`ourArray` ora conterrà `[0,2,4,6,8]`. Cambiamo la nostra `initialization` in modo da poter iterare sui numeri dispari.
+`ourArray` ora conterrà `[0, 2, 4, 6, 8]`. Cambiamo la nostra `initialization` in modo da poter iterare sui numeri dispari.
# --instructions--
@@ -34,7 +35,7 @@ Dovresti usare un ciclo `for`.
assert(/for\s*\([^)]+?\)/.test(code));
```
-`myArray` dovrebbe essere uguale a `[1,3,5,7,9]`.
+`myArray` dovrebbe essere uguale a `[1, 3, 5, 7, 9]`.
```js
assert.deepEqual(myArray, [1, 3, 5, 7, 9]);
@@ -52,16 +53,17 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
+const myArray = [];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [];
-for (var i = 1; i < 10; i += 2) {
+const myArray = [];
+for (let i = 1; i < 10; i += 2) {
myArray.push(i);
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
index ab85b7eac8..5be90a8aae 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
@@ -12,8 +12,9 @@ dashedName: iterate-through-an-array-with-a-for-loop
Un compito comune in JavaScript è quello di iterare attraverso i contenuti di un array. Un modo per farlo è con un ciclo `for`. Questo codice visualizzerà ogni elemento dell'array `arr` nella console:
```js
-var arr = [10, 9, 8, 7, 6];
-for (var i = 0; i < arr.length; i++) {
+const arr = [10, 9, 8, 7, 6];
+
+for (let i = 0; i < arr.length; i++) {
console.log(arr[i]);
}
```
@@ -62,18 +63,19 @@ assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
```js
// Setup
-var myArr = [ 2, 3, 4, 5, 6];
+const myArr = [2, 3, 4, 5, 6];
// Only change code below this line
+
```
# --solutions--
```js
-var myArr = [ 2, 3, 4, 5, 6];
-var total = 0;
+const myArr = [2, 3, 4, 5, 6];
+let total = 0;
-for (var i = 0; i < myArr.length; i++) {
+for (let i = 0; i < myArr.length; i++) {
total += myArr[i];
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
index 83c3450121..e55ddddf26 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
@@ -12,8 +12,9 @@ dashedName: iterate-with-javascript-do---while-loops
Il prossimo tipo di ciclo che vedremo si chiama `do...while`. Si chiama ciclo `do... while` perché prima eseguirà (`do`) un passaggio del codice all'interno del ciclo indipendentemente dalle condizioni, e poi continuerà ad eseguire il ciclo finché (`while`) la condizione specificata avrà valore `true`.
```js
-var ourArray = [];
-var i = 0;
+const ourArray = [];
+let i = 0;
+
do {
ourArray.push(i);
i++;
@@ -23,8 +24,9 @@ do {
L'esempio sopra si comporta come altri tipi di cicli, e l'array risultante sarà `[0, 1, 2, 3, 4]`. Tuttavia, ciò che rende il `do...while` diverso da altri cicli è come si comporta quando la condizione fallisce al primo controllo. Vediamolo in azione: ecco un normale ciclo `while` che eseguirà il codice nel ciclo finché `i < 5`:
```js
-var ourArray = [];
-var i = 5;
+const ourArray = [];
+let i = 5;
+
while (i < 5) {
ourArray.push(i);
i++;
@@ -34,8 +36,9 @@ while (i < 5) {
In questo esempio, inizializziamo il valore di `ourArray` a un array vuoto e il valore di `i` a 5. Quando eseguiamo il ciclo `while`, la condizione vale `false` perché `i` non è inferiore a 5, e in questo modo non eseguiremo il codice all'interno del ciclo. Il risultato è che `ourArray` finirà per non avere valori aggiunti, e sarà ancora simile a `[]` quando tutto il codice nell'esempio precedente sarà stato completato. Ora, dai un'occhiata a un ciclo `do...while`:
```js
-var ourArray = [];
-var i = 5;
+const ourArray = [];
+let i = 5;
+
do {
ourArray.push(i);
i++;
@@ -80,8 +83,8 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
-var i = 10;
+const myArray = [];
+let i = 10;
// Only change code below this line
while (i < 5) {
@@ -93,8 +96,8 @@ while (i < 5) {
# --solutions--
```js
-var myArray = [];
-var i = 10;
+const myArray = [];
+let i = 10;
do {
myArray.push(i);
i++;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
index 4ad581c295..46a73d0507 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
@@ -26,13 +26,14 @@ L'espressione finale è eseguita alla fine di ogni iterazione del ciclo, prima d
Nell'esempio seguente inizializziamo con `i = 0` e iteriamo finché la nostra condizione `i < 5` è vera. Incrementeremo `i` di `1` ad ogni iterazione del ciclo con `i++` come espressione finale.
```js
-var ourArray = [];
-for (var i = 0; i < 5; i++) {
+const ourArray = [];
+
+for (let i = 0; i < 5; i++) {
ourArray.push(i);
}
```
-`ourArray` ha ora il valore `[0,1,2,3,4]`.
+`ourArray` ha ora il valore `[0, 1, 2, 3, 4]`.
# --instructions--
@@ -46,7 +47,7 @@ Dovresti usare un ciclo `for`.
assert(/for\s*\([^)]+?\)/.test(code));
```
-`myArray` dovrebbe essere uguale a `[1,2,3,4,5]`.
+`myArray` dovrebbe essere uguale a `[1, 2, 3, 4, 5]`.
```js
assert.deepEqual(myArray, [1, 2, 3, 4, 5]);
@@ -64,16 +65,17 @@ if (typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
+const myArray = [];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [];
-for (var i = 1; i < 6; i++) {
+const myArray = [];
+for (let i = 1; i < 6; i++) {
myArray.push(i);
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
index 266673087d..0aa2bb494e 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
@@ -14,9 +14,10 @@ dashedName: iterate-with-javascript-while-loops
Il primo tipo di ciclo che vedremo è chiamato un ciclo `while` perché viene eseguito finché (while) una condizione specificata è vera e si arresta una volta che la condizione non è più vera.
```js
-var ourArray = [];
-var i = 0;
-while(i < 5) {
+const ourArray = [];
+let i = 0;
+
+while (i < 5) {
ourArray.push(i);
i++;
}
@@ -38,7 +39,7 @@ Dovresti usare un ciclo `while`.
assert(code.match(/while/g));
```
-`myArray` dovrebbe essere uguale a `[5,4,3,2,1,0]`.
+`myArray` dovrebbe essere uguale a `[5, 4, 3, 2, 1, 0]`.
```js
assert.deepEqual(myArray, [5, 4, 3, 2, 1, 0]);
@@ -56,17 +57,18 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
+const myArray = [];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [];
-var i = 5;
-while(i >= 0) {
+const myArray = [];
+let i = 5;
+while (i >= 0) {
myArray.push(i);
i--;
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
index cd289d6d2e..49cc50547e 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
@@ -15,9 +15,10 @@ Ecco una funzione `myTest` con una variabile locale chiamata `loc`.
```js
function myTest() {
- var loc = "foo";
+ const loc = "foo";
console.log(loc);
}
+
myTest();
console.log(loc);
```
@@ -38,6 +39,7 @@ Il codice non dovrebbe contenere una variabile globale `myVar`.
function declared() {
myVar;
}
+
assert.throws(declared, ReferenceError);
```
@@ -57,7 +59,6 @@ assert(
```js
function myLocalScope() {
-
// Only change code below this line
console.log('inside myLocalScope', myVar);
@@ -73,9 +74,8 @@ console.log('outside myLocalScope', myVar);
```js
function myLocalScope() {
-
// Only change code below this line
- var myVar;
+ let myVar;
console.log('inside myLocalScope', myVar);
}
myLocalScope();
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
index c1e3d5b8e9..1b84fa8670 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
@@ -16,8 +16,8 @@ Un altro modo per cambiare i dati in un array è con la funzione `.pop()`.
Qualsiasi tipo di elemento può essere estratto da un array - numeri, stringhe, anche array annidati.
```js
-var threeArr = [1, 4, 6];
-var oneDown = threeArr.pop();
+const threeArr = [1, 4, 6];
+const oneDown = threeArr.pop();
console.log(oneDown);
console.log(threeArr);
```
@@ -26,7 +26,7 @@ Il primo `console.log` mostrerà il valore `6`e il secondo mostrerà il valore `
# --instructions--
-Utilizza la funzione `.pop()` per rimuovere l'ultimo elemento da `myArray`, assegnando il valore estratto a `removedFromMyArray`.
+Utilizza la funzione `.pop()` per rimuovere l'ultimo elemento da `myArray` e assegna il valore estratto a `removedFromMyArray`.
# --hints--
@@ -69,22 +69,22 @@ assert(
## --after-user-code--
```js
-(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
+if (typeof removedFromMyArray !== 'undefined') (function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
```
## --seed-contents--
```js
// Setup
-var myArray = [["John", 23], ["cat", 2]];
+const myArray = [["John", 23], ["cat", 2]];
// Only change code below this line
-var removedFromMyArray;
+
```
# --solutions--
```js
-var myArray = [["John", 23], ["cat", 2]];
-var removedFromMyArray = myArray.pop();
+const myArray = [["John", 23], ["cat", 2]];
+const removedFromMyArray = myArray.pop();
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
index a09fe87259..f1ffde2dfb 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
@@ -16,10 +16,10 @@ Un modo semplice per aggiungere dei dati alla fine di un array è tramite la fun
Esempi:
```js
-var arr1 = [1,2,3];
+const arr1 = [1, 2, 3];
arr1.push(4);
-var arr2 = ["Stimpson", "J", "cat"];
+const arr2 = ["Stimpson", "J", "cat"];
arr2.push(["happy", "joy"]);
```
@@ -64,14 +64,15 @@ assert(
```js
// Setup
-var myArray = [["John", 23], ["cat", 2]];
+const myArray = [["John", 23], ["cat", 2]];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [["John", 23], ["cat", 2]];
+const myArray = [["John", 23], ["cat", 2]];
myArray.push(["dog",3]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
index 6486d361e5..302b952f49 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
@@ -16,15 +16,15 @@ dashedName: manipulate-arrays-with-shift
Esempio:
```js
-var ourArray = ["Stimpson", "J", ["cat"]];
-var removedFromOurArray = ourArray.shift();
+const ourArray = ["Stimpson", "J", ["cat"]];
+const removedFromOurArray = ourArray.shift();
```
`removedFromOurArray` dovrebbe avere un valore stringa `Stimpson`e `ourArray` dovrebbe valere `["J", ["cat"]]`.
# --instructions--
-Utilizza la funzione `.shift()` per rimuovere il primo elemento da `myArray`, assegnando il valore "spostato" a `removedFromMyArray`.
+Utilizza la funzione `.shift()` per rimuovere il primo elemento da `myArray` e assegna il valore estratto a `removedFromMyArray`.
# --hints--
@@ -65,24 +65,24 @@ assert(
## --after-user-code--
```js
-(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
+if (typeof removedFromMyArray !== 'undefined') (function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);
```
## --seed-contents--
```js
// Setup
-var myArray = [["John", 23], ["dog", 3]];
+const myArray = [["John", 23], ["dog", 3]];
// Only change code below this line
-var removedFromMyArray;
+
```
# --solutions--
```js
-var myArray = [["John", 23], ["dog", 3]];
+const myArray = [["John", 23], ["dog", 3]];
// Only change code below this line
-var removedFromMyArray = myArray.shift();
+const removedFromMyArray = myArray.shift();
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
index 63437d2bd2..9eded38dad 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
@@ -16,7 +16,7 @@ Non puoi solo fare uno `shift` di elementi dall'inizio di un array: puoi anche f
Esempio:
```js
-var ourArray = ["Stimpson", "J", "cat"];
+const ourArray = ["Stimpson", "J", "cat"];
ourArray.shift();
ourArray.unshift("Happy");
```
@@ -25,7 +25,7 @@ Dopo lo `shift`, `ourArray` avrà il valore `["J", "cat"]`. Dopo l'`unshift`, `o
# --instructions--
-Aggiungi `["Paul",35]` all'inizio della variabile `myArray` usando `unshift()`.
+Aggiungi `["Paul", 35]` all'inizio della variabile `myArray` usando `unshift()`.
# --hints--
@@ -63,16 +63,17 @@ assert(
```js
// Setup
-var myArray = [["John", 23], ["dog", 3]];
+const myArray = [["John", 23], ["dog", 3]];
myArray.shift();
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [["John", 23], ["dog", 3]];
+const myArray = [["John", 23], ["dog", 3]];
myArray.shift();
myArray.unshift(["Paul", 35]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
index 7dc5e34fff..ee2a3f97b1 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
@@ -14,7 +14,7 @@ A volte potresti voler memorizzare i dati in una struttura di dati fl
Ecco un esempio di struttura di dati complessa:
```js
-var ourMusic = [
+const ourMusic = [
{
"artist": "Daft Punk",
"title": "Homework",
@@ -135,7 +135,7 @@ myMusic.forEach(object => {
## --seed-contents--
```js
-var myMusic = [
+const myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
@@ -153,7 +153,7 @@ var myMusic = [
# --solutions--
```js
-var myMusic = [
+const myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
index e1d6023794..f88063fda3 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
@@ -9,12 +9,12 @@ dashedName: modify-array-data-with-indexes
# --description--
-A differenza delle stringhe, gli elementi degli array sono mutabili e possono essere cambiati liberamente.
+A differenza delle stringhe, gli elementi degli array sono mutabili e possono essere cambiati liberamente, anche se l'array è stato dichiarato con `const`.
**Esempio**
```js
-var ourArray = [50,40,30];
+const ourArray = [50, 40, 30];
ourArray[0] = 15;
```
@@ -28,7 +28,7 @@ Modificare i dati memorizzati all'indice `0` di `myArray` a un valore di `45`.
# --hints--
-`myArray` dovrebbe ora essere `[45,64,99]`.
+`myArray` dovrebbe ora essere `[45, 64, 99]`.
```js
assert(
@@ -73,14 +73,15 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [18,64,99];
+const myArray = [18, 64, 99];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [18,64,99];
+const myArray = [18, 64, 99];
myArray[0] = 45;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
index 91ee911e17..75ac587771 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
@@ -12,7 +12,7 @@ dashedName: multiple-identical-options-in-switch-statements
Se l'istruzione `break` viene omessa da un'istruzione `switch` e in particolare da un suo `case`, le istruzione `case` successive sono eseguite fino a quando non si incontra un `break`. Se hai diversi input con lo stesso output, potrai rappresentarli in un'istruzione `switch` come la seguente:
```js
-var result = "";
+let result = "";
switch(val) {
case 1:
case 2:
@@ -109,7 +109,7 @@ assert(code.match(/case/g).length === 9);
```js
function sequentialSizes(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
@@ -125,7 +125,7 @@ sequentialSizes(1);
```js
function sequentialSizes(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case 1:
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
index 0154e925e8..ba1c14e105 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
@@ -42,11 +42,11 @@ assert(/\*/.test(code));
## --seed-contents--
```js
-var product = 2.0 * 0.0;
+const product = 2.0 * 0.0;
```
# --solutions--
```js
-var product = 2.0 * 2.5;
+const product = 2.0 * 2.5;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
index 9f83522436..4895a754e9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript utilizza il simbolo `*` per la moltiplicazione di due numeri.
**Esempio**
```js
-myVar = 13 * 13;
+const myVar = 13 * 13;
```
`myVar` dovrebbe avere il valore `169`.
@@ -50,11 +50,11 @@ assert(/\*/.test(code));
## --seed-contents--
```js
-var product = 8 * 0;
+const product = 8 * 0;
```
# --solutions--
```js
-var product = 8 * 10;
+const product = 8 * 10;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
index 63ca252c75..a0d376d974 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
@@ -12,7 +12,7 @@ dashedName: nest-one-array-within-another-array
È anche possibile nidificare array all'interno di altri array, come nell'esempio:
```js
-[["Bulls", 23], ["White Sox", 45]]
+const teams = [["Bulls", 23], ["White Sox", 45]];
```
Questo viene anche chiamato un array multidimensionale.
@@ -41,11 +41,11 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Only change code below this line
-var myArray = [];
+const myArray = [];
```
# --solutions--
```js
-var myArray = [[1,2,3]];
+const myArray = [[1, 2, 3]];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
index c098d946a5..111d183e81 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
@@ -12,11 +12,12 @@ dashedName: nesting-for-loops
Se disponi di un array multidimensionale, è possibile utilizzare la stessa logica del punto precedente per iterare sia attraverso l'array che attraverso i suoi sottoarray. Ecco un esempio:
```js
-var arr = [
- [1,2], [3,4], [5,6]
+const arr = [
+ [1, 2], [3, 4], [5, 6]
];
-for (var i=0; i < arr.length; i++) {
- for (var j=0; j < arr[i].length; j++) {
+
+for (let i = 0; i < arr.length; i++) {
+ for (let j = 0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
@@ -30,13 +31,13 @@ Modifica la funzione `multiplyAll` in modo che restituisca il prodotto di tutti
# --hints--
-`multiplyAll([[1],[2],[3]])` dovrebbe restituire `6`
+`multiplyAll([[1], [2], [3]])` dovrebbe restituire `6`
```js
assert(multiplyAll([[1], [2], [3]]) === 6);
```
-`multiplyAll([[1,2],[3,4],[5,6,7]])` dovrebbe restituire `5040`
+`multiplyAll([[1, 2], [3, 4], [5, 6, 7]])` dovrebbe restituire `5040`
```js
assert(
@@ -48,7 +49,7 @@ assert(
);
```
-`multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])` dovrebbe restituire `54`
+`multiplyAll([[5, 1], [0.2, 4, 0.5], [3, 9]])` dovrebbe restituire `54`
```js
assert(
@@ -66,28 +67,26 @@ assert(
```js
function multiplyAll(arr) {
- var product = 1;
+ let product = 1;
// Only change code below this line
// Only change code above this line
return product;
}
-multiplyAll([[1,2],[3,4],[5,6,7]]);
+multiplyAll([[1, 2], [3, 4], [5, 6, 7]]);
```
# --solutions--
```js
function multiplyAll(arr) {
- var product = 1;
- for (var i = 0; i < arr.length; i++) {
- for (var j = 0; j < arr[i].length; j++) {
+ let product = 1;
+ for (let i = 0; i < arr.length; i++) {
+ for (let j = 0; j < arr[i].length; j++) {
product *= arr[i][j];
}
}
return product;
}
-
-multiplyAll([[1,2],[3,4],[5,6,7]]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
index ee07d56f52..f4955a3dd1 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
@@ -68,34 +68,33 @@ assert(lookUpProfile('Akira', 'address') === 'No such property');
```js
// Setup
-var contacts = [
- {
- "firstName": "Akira",
- "lastName": "Laine",
- "number": "0543236543",
- "likes": ["Pizza", "Coding", "Brownie Points"]
- },
- {
- "firstName": "Harry",
- "lastName": "Potter",
- "number": "0994372684",
- "likes": ["Hogwarts", "Magic", "Hagrid"]
- },
- {
- "firstName": "Sherlock",
- "lastName": "Holmes",
- "number": "0487345643",
- "likes": ["Intriguing Cases", "Violin"]
- },
- {
- "firstName": "Kristian",
- "lastName": "Vos",
- "number": "unknown",
- "likes": ["JavaScript", "Gaming", "Foxes"]
- }
+const contacts = [
+ {
+ firstName: "Akira",
+ lastName: "Laine",
+ number: "0543236543",
+ likes: ["Pizza", "Coding", "Brownie Points"],
+ },
+ {
+ firstName: "Harry",
+ lastName: "Potter",
+ number: "0994372684",
+ likes: ["Hogwarts", "Magic", "Hagrid"],
+ },
+ {
+ firstName: "Sherlock",
+ lastName: "Holmes",
+ number: "0487345643",
+ likes: ["Intriguing Cases", "Violin"],
+ },
+ {
+ firstName: "Kristian",
+ lastName: "Vos",
+ number: "unknown",
+ likes: ["JavaScript", "Gaming", "Foxes"],
+ },
];
-
function lookUpProfile(name, prop) {
// Only change code below this line
@@ -108,44 +107,38 @@ lookUpProfile("Akira", "likes");
# --solutions--
```js
-var contacts = [
- {
- "firstName": "Akira",
- "lastName": "Laine",
- "number": "0543236543",
- "likes": ["Pizza", "Coding", "Brownie Points"]
- },
- {
- "firstName": "Harry",
- "lastName": "Potter",
- "number": "0994372684",
- "likes": ["Hogwarts", "Magic", "Hagrid"]
- },
- {
- "firstName": "Sherlock",
- "lastName": "Holmes",
- "number": "0487345643",
- "likes": ["Intriguing Cases", "Violin"]
- },
- {
- "firstName": "Kristian",
- "lastName": "Vos",
- "number": "unknown",
- "likes": ["JavaScript", "Gaming", "Foxes"]
- },
+const contacts = [
+ {
+ firstName: "Akira",
+ lastName: "Laine",
+ number: "0543236543",
+ likes: ["Pizza", "Coding", "Brownie Points"],
+ },
+ {
+ firstName: "Harry",
+ lastName: "Potter",
+ number: "0994372684",
+ likes: ["Hogwarts", "Magic", "Hagrid"],
+ },
+ {
+ firstName: "Sherlock",
+ lastName: "Holmes",
+ number: "0487345643",
+ likes: ["Intriguing Cases", "Violin"],
+ },
+ {
+ firstName: "Kristian",
+ lastName: "Vos",
+ number: "unknown",
+ likes: ["JavaScript", "Gaming", "Foxes"],
+ },
];
-
-
-//Write your function in between these comments
-function lookUpProfile(name, prop){
- for(var i in contacts){
- if(contacts[i].firstName === name) {
- return contacts[i][prop] || "No such property";
- }
+function lookUpProfile(name, prop) {
+ for (let i in contacts) {
+ if (contacts[i].firstName === name) {
+ return contacts[i][prop] || "No such property";
}
- return "No such contact";
+ }
+ return "No such contact";
}
-//Write your function in between these comments
-
-lookUpProfile("Akira", "likes");
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
index 4bfd19ae6c..5f9caec414 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
@@ -12,21 +12,21 @@ dashedName: quoting-strings-with-single-quotes
I valori Stringa in JavaScript possono essere scritti con virgolette singole o doppie, purché si inizi e si termini con lo stesso tipo di virgolette. A differenza di alcuni altri linguaggi di programmazione, le virgolette singole e doppie funzionano allo stesso modo in JavaScript.
```js
-doubleQuoteStr = "This is a string";
-singleQuoteStr = 'This is also a string';
+const doubleQuoteStr = "This is a string";
+const singleQuoteStr = 'This is also a string';
```
Il motivo per cui potresti voler usare un tipo di virgolette piuttosto dell'altro è se volessi usare entrambi in una stringa. Questo potrebbe accadere volendo salvare una conversazione in una stringa e avendo la conversazione tra virgolette. Un altro uso sarebbe salvare un tag `` con vari attributi tra virgolette, tutto all'interno di una stringa.
```js
-conversation = 'Finn exclaims to Jake, "Algebraic!"';
+const conversation = 'Finn exclaims to Jake, "Algebraic!"';
```
Tuttavia, questo diventa un problema se è necessario utilizzare le virgolette più esterne al suo interno. Ricorda, una stringa ha lo stesso tipo di virgolette all'inizio e alla fine. Ma se hai la stessa virgoletta da qualche parte nel mezzo, la stringa si fermerà anzitempo e lancerà un errore.
```js
-goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
-badStr = 'Finn responds, "Let's go!"';
+const goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
+const badStr = 'Finn responds, "Let's go!"';
```
Qui `badStr` genererà un errore.
@@ -71,11 +71,11 @@ assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
## --seed-contents--
```js
-var myStr = "Link";
+const myStr = "Link";
```
# --solutions--
```js
-var myStr = 'Link';
+const myStr = 'Link';
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
index 3614886d35..12a7b5a260 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
@@ -115,7 +115,7 @@ const _recordCollection = {
```js
// Setup
-var recordCollection = {
+const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
@@ -146,7 +146,7 @@ updateRecords(recordCollection, 5439, 'artist', 'ABBA');
# --solutions--
```js
-var recordCollection = {
+const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
index 33bba64de8..a429908231 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
@@ -14,9 +14,9 @@ La ricorsione è il concetto che una funzione può essere espressa in termini di
```js
function multiply(arr, n) {
- var product = 1;
- for (var i = 0; i < n; i++) {
- product *= arr[i];
+ let product = 1;
+ for (let i = 0; i < n; i++) {
+ product *= arr[i];
}
return product;
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
index 6db6c8ebfc..0495ccbb34 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
@@ -108,7 +108,7 @@ assert(chainToSwitch(156) === '');
```js
function chainToSwitch(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
if (val === "bob") {
@@ -134,7 +134,7 @@ chainToSwitch(7);
```js
function chainToSwitch(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case "bob":
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
index 3ef69cfb90..a00a5893cb 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
@@ -17,7 +17,8 @@ Possiamo passare dei valori a una funzione con gli argomenti. È poss
function plusThree(num) {
return num + 3;
}
-var answer = plusThree(5);
+
+const answer = plusThree(5);
```
`answer` ha il valore `8`.
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
index bfab0e5bbe..102f744000 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
@@ -33,43 +33,43 @@ Ricorda che [`undefined` è una parola chiave](https://www.freecodecamp.org/lear
# --hints--
-`abTest(2,2)` dovrebbe restituire un numero
+`abTest(2, 2)` dovrebbe restituire un numero
```js
assert(typeof abTest(2, 2) === 'number');
```
-`abTest(2,2)` dovrebbe restituire `8`
+`abTest(2, 2)` dovrebbe restituire `8`
```js
assert(abTest(2, 2) === 8);
```
-`abTest(-2,2)` dovrebbe restituire `undefined`
+`abTest(-2, 2)` dovrebbe restituire `undefined`
```js
assert(abTest(-2, 2) === undefined);
```
-`abTest(2,-2)` dovrebbe restituire `undefined`
+`abTest(2, -2)` dovrebbe restituire `undefined`
```js
assert(abTest(2, -2) === undefined);
```
-`abTest(2,8)` dovrebbe restituire `18`
+`abTest(2, 8)` dovrebbe restituire `18`
```js
assert(abTest(2, 8) === 18);
```
-`abTest(3,3)` dovrebbe restituire `12`
+`abTest(3, 3)` dovrebbe restituire `12`
```js
assert(abTest(3, 3) === 12);
```
-`abTest(0,0)` dovrebbe restituire `0`
+`abTest(0, 0)` dovrebbe restituire `0`
```js
assert(abTest(0, 0) === 0);
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
index 661409438e..7f4c3d06b4 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
@@ -14,7 +14,7 @@ dashedName: returning-boolean-values-from-functions
A volte le persone usano un'istruzione `if/else` per fare un confronto, in questo modo:
```js
-function isEqual(a,b) {
+function isEqual(a, b) {
if (a === b) {
return true;
} else {
@@ -26,7 +26,7 @@ function isEqual(a,b) {
Ma c'è un modo migliore per farlo. Dal momento che `===` restituisce `true` o `false`, possiamo restituire il risultato del confronto:
```js
-function isEqual(a,b) {
+function isEqual(a, b) {
return a === b;
}
```
@@ -37,13 +37,13 @@ Correggi la funzione `isLess` per rimuovere le istruzioni `if/else`.
# --hints--
-`isLess(10,15)` dovrebbe restituire `true`
+`isLess(10, 15)` dovrebbe restituire `true`
```js
assert(isLess(10, 15) === true);
```
-`isLess(15,10)` dovrebbe restituire `false`
+`isLess(15, 10)` dovrebbe restituire `false`
```js
assert(isLess(15, 10) === false);
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
index cb0671f1e6..155d38ab42 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
@@ -78,7 +78,7 @@ assert(code.match(/break/g).length > 2);
```js
function caseInSwitch(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
@@ -94,7 +94,7 @@ caseInSwitch(1);
```js
function caseInSwitch(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case 1:
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
index e5815c13d4..1e73a85374 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
@@ -81,13 +81,13 @@ var hasNumber = false;
## --seed-contents--
```js
-var myList = [];
+const myList = [];
```
# --solutions--
```js
-var myList = [
+const myList = [
["Candy", 10],
["Potatoes", 12],
["Eggs", 12],
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
index 0d18c887b4..1547a7b8a4 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
@@ -93,12 +93,10 @@ function nextInLine(arr, item) {
return item;
// Only change code above this line
-
-
}
// Setup
-var testArr = [1,2,3,4,5];
+const testArr = [1, 2, 3, 4, 5];
// Display code
console.log("Before: " + JSON.stringify(testArr));
@@ -109,7 +107,7 @@ console.log("After: " + JSON.stringify(testArr));
# --solutions--
```js
-var testArr = [ 1,2,3,4,5];
+const testArr = [1, 2, 3, 4, 5];
function nextInLine(arr, item) {
arr.push(item);
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
index d280f77f5b..99e986b2a9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
@@ -14,7 +14,7 @@ Con le variabili `array` di JavaScript, possiamo memorizzare diversi dati in un
La dichiarazione di un array inizia con una parentesi quadra di apertura, e termina con una parentesi quadra di chiusura, con gli elementi separati da virgole, in questo modo:
```js
-var sandwich = ["peanut butter", "jelly", "bread"]
+const sandwich = ["peanut butter", "jelly", "bread"];
```
# --instructions--
@@ -53,11 +53,11 @@ assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
```js
// Only change code below this line
-var myArray = [];
+const myArray = [];
```
# --solutions--
```js
-var myArray = ["The Answer", 42];
+const myArray = ["The Answer", 42];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
index 767509bb36..627d6b8ff6 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript utilizza il simbolo `-` per la sottrazione.
**Esempio**
```js
-myVar = 12 - 6;
+const myVar = 12 - 6;
```
`myVar` avrà il valore `6`.
@@ -49,11 +49,11 @@ assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));
## --seed-contents--
```js
-var difference = 45 - 0;
+const difference = 45 - 0;
```
# --solutions--
```js
-var difference = 45 - 33;
+const difference = 45 - 33;
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index a7ac814057..01345fc396 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -13,10 +13,11 @@ A volte è utile verificare se la proprietà di un dato oggetto esiste o meno. P
**Esempio**
```js
-var myObj = {
+const myObj = {
top: "hat",
bottom: "pants"
};
+
myObj.hasOwnProperty("top");
myObj.hasOwnProperty("middle");
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
index 779c4661df..0f3a4e8bb7 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
@@ -14,14 +14,14 @@ In JavaScript, le stringhe (`String`) sono immutabili, il che signifi
Ad esempio, il codice seguente:
```js
-var myStr = "Bob";
+let myStr = "Bob";
myStr[0] = "J";
```
non può modificare il valore di `myStr` in `Job`, poiché il contenuto di `myStr` non può essere modificato. Tieni presente che questo *non* significa che `myStr` non può essere modificato, ma solo che i singoli caratteri di una stringa letterale non possono essere cambiati. L'unico modo per modificare `myStr` è di assegnargli una nuova stringa, in questo modo:
```js
-var myStr = "Bob";
+let myStr = "Bob";
myStr = "Job";
```
@@ -55,7 +55,7 @@ assert(/myStr = "Jello World"/.test(code));
```js
// Setup
-var myStr = "Jello World";
+let myStr = "Jello World";
// Only change code below this line
myStr[0] = "H"; // Change this line
@@ -65,6 +65,6 @@ myStr[0] = "H"; // Change this line
# --solutions--
```js
-var myStr = "Jello World";
+let myStr = "Jello World";
myStr = "Hello World";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
index 15d85f5f60..5d3c5e13fc 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
@@ -43,7 +43,6 @@ welcomeToBooleans();
```js
function welcomeToBooleans() {
-
// Only change code below this line
return false; // Change this line
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
index ec452a1a41..c622963208 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
@@ -14,10 +14,12 @@ Una funzione può includere l'istruzione `return` ma questa non deve essere nece
**Esempio**
```js
-var sum = 0;
+let sum = 0;
+
function addSum(num) {
sum = sum + num;
}
+
addSum(3);
```
@@ -61,7 +63,7 @@ assert(
```js
// Setup
-var sum = 0;
+let sum = 0;
function addThree() {
sum = sum + 3;
@@ -79,7 +81,7 @@ addFive();
# --solutions--
```js
-var sum = 0;
+let sum = 0;
function addThree() {
sum = sum + 3;
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
index c3141f438f..27d8a790c0 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
@@ -14,7 +14,7 @@ Dopo aver creato un oggetto JavaScript, è possibile aggiornare le sue propriet
Ad esempio, diamo un'occhiata a `ourDog`:
```js
-var ourDog = {
+const ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
@@ -54,7 +54,7 @@ assert(/"name": "Coder"/.test(code));
```js
// Setup
-var myDog = {
+const myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
@@ -62,12 +62,13 @@ var myDog = {
};
// Only change code below this line
+
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
index 7b22d3e89f..a4f84e0268 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
@@ -13,13 +13,13 @@ dashedName: use-bracket-notation-to-find-the-first-character-in-a-string
La maggior parte dei moderni linguaggi di programmazione, come JavaScript, non inizia a contare da 1 come gli esseri umani. Loro iniziano dallo 0. Questo è indicato come indicizzazione Zero-based.
-Ad esempio, il carattere all'indice 0 nella parola `Charles` è `C`. Quindi, se `var firstName = "Charles"`, è possibile ottenere il valore della prima lettera della stringa utilizzando `firstName[0]`.
+Ad esempio, il carattere all'indice 0 nella parola `Charles` è `C`. Quindi, se `const firstName = "Charles"`, è possibile ottenere il valore della prima lettera della stringa utilizzando `firstName[0]`.
Esempio:
```js
-var firstName = "Charles";
-var firstLetter = firstName[0];
+const firstName = "Charles";
+const firstLetter = firstName[0];
```
`firstLetter` dovrebbe avere un valore stringa `C`.
@@ -56,8 +56,8 @@ assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```js
// Setup
-var firstLetterOfLastName = "";
-var lastName = "Lovelace";
+let firstLetterOfLastName = "";
+const lastName = "Lovelace";
// Only change code below this line
firstLetterOfLastName = lastName; // Change this line
@@ -66,8 +66,8 @@ firstLetterOfLastName = lastName; // Change this line
# --solutions--
```js
-var firstLetterOfLastName = "";
-var lastName = "Lovelace";
+let firstLetterOfLastName = "";
+const lastName = "Lovelace";
// Only change code below this line
firstLetterOfLastName = lastName[0];
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
index 728b070b50..e19e3fe9fe 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
@@ -11,13 +11,13 @@ dashedName: use-bracket-notation-to-find-the-last-character-in-a-string
Al fine di ottenere l'ultima lettera di una stringa, è possibile sottrarre uno dalla lunghezza della stringa.
-Per esempio, se `var firstName = "Ada"`, puoi ottenere il valore dell'ultima lettera della stringa usando `firstName[firstName.length - 1]`.
+Per esempio, se `const firstName = "Ada"`, puoi ottenere il valore dell'ultima lettera della stringa usando `firstName[firstName.length - 1]`.
Esempio:
```js
-var firstName = "Ada";
-var lastLetter = firstName[firstName.length - 1];
+const firstName = "Ada";
+const lastLetter = firstName[firstName.length - 1];
```
`lastLetter` dovrebbe avere un valore stringa `a`.
@@ -54,15 +54,15 @@ assert(code.match(/\.length/g).length > 0);
```js
// Setup
-var lastName = "Lovelace";
+const lastName = "Lovelace";
// Only change code below this line
-var lastLetterOfLastName = lastName; // Change this line
+const lastLetterOfLastName = lastName; // Change this line
```
# --solutions--
```js
-var lastName = "Lovelace";
-var lastLetterOfLastName = lastName[lastName.length - 1];
+const lastName = "Lovelace";
+const lastLetterOfLastName = lastName[lastName.length - 1];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
index 32b4010e76..0e89b3f80f 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
@@ -16,8 +16,8 @@ Ricorda che i computer iniziano a contare da `0`, quindi il primo carattere è i
Esempio:
```js
-var firstName = "Ada";
-var secondLetterOfFirstName = firstName[1];
+const firstName = "Ada";
+const secondLetterOfFirstName = firstName[1];
```
`secondLetterOfFirstName` dovrebbe acere un valore stringa `d`.
@@ -54,15 +54,15 @@ assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```js
// Setup
-var lastName = "Lovelace";
+const lastName = "Lovelace";
// Only change code below this line
-var thirdLetterOfLastName = lastName; // Change this line
+const thirdLetterOfLastName = lastName; // Change this line
```
# --solutions--
```js
-var lastName = "Lovelace";
-var thirdLetterOfLastName = lastName[2];
+const lastName = "Lovelace";
+const thirdLetterOfLastName = lastName[2];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
index f29cf5783d..9e288b6f46 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
@@ -11,13 +11,13 @@ dashedName: use-bracket-notation-to-find-the-nth-to-last-character-in-a-string
È possibile utilizzare lo stesso principio che abbiamo appena usato per recuperare l'ultimo carattere in una stringa per recuperare il carattere n-ultimo dalla fine.
-Ad esempio, puoi ottenere il valore della terzultima lettera della stringa `var firstName = "Augusta"` usando `firstName[firstName. lunghezza - 3]`
+Ad esempio, puoi ottenere il valore della terzultima lettera della stringa `const firstName = "Augusta"` usando `firstName[firstName.length - 3]`
Esempio:
```js
-var firstName = "Augusta";
-var thirdToLastLetter = firstName[firstName.length - 3];
+const firstName = "Augusta";
+const thirdToLastLetter = firstName[firstName.length - 3];
```
`thirdToLastLetter` dovrebbe avere un valore stringa `s`.
@@ -54,15 +54,15 @@ assert(code.match(/\.length/g).length > 0);
```js
// Setup
-var lastName = "Lovelace";
+const lastName = "Lovelace";
// Only change code below this line
-var secondToLastLetterOfLastName = lastName; // Change this line
+const secondToLastLetterOfLastName = lastName; // Change this line
```
# --solutions--
```js
-var lastName = "Lovelace";
-var secondToLastLetterOfLastName = lastName[lastName.length - 2];
+const lastName = "Lovelace";
+const secondToLastLetterOfLastName = lastName[lastName.length - 2];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
index d563f229c8..a0712627a3 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
@@ -9,7 +9,7 @@ dashedName: use-conditional-logic-with-if-statements
# --description--
-Le istruzioni `If` sono usate nel codice per prendere decisioni. La parola chiave `if` dice a JavaScript di eseguire il codice nelle parentesi graffe in determinate condizioni, definite nelle parentesi tonde. Queste condizioni sono note come condizioni `Boolean` e possono essere solo `true` o `false`.
+Le istruzioni `if` sono usate nel codice per prendere decisioni. La parola chiave `if` dice a JavaScript di eseguire il codice nelle parentesi graffe in determinate condizioni, definite nelle parentesi tonde. Queste condizioni sono note come condizioni `Boolean` e possono essere solo `true` o `false`.
Quando la condizione valuta un `true`, il programma esegue la dichiarazione all'interno delle parentesi graffe. Quando la condizione booleana valuta un `false`, la dichiarazione all'interno delle parentesi graffe non sarà eseguita.
@@ -22,10 +22,11 @@ Quando la condizione valuta un `true`, il programma esegue la dichiarazione all'
```js
function test (myCondition) {
if (myCondition) {
- return "It was true";
+ return "It was true";
}
return "It was false";
}
+
test(true);
test(false);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
index 3f3574500e..11cfe95741 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
@@ -73,7 +73,7 @@ function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
- var numbers = rangeOfNumbers(startNum, endNum - 1);
+ const numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
index a13766d684..a4001a6006 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
@@ -20,7 +20,7 @@ parseInt(string, radix);
Ecco un esempio:
```js
-var a = parseInt("11", 2);
+const a = parseInt("11", 2);
```
La variabile radix dice che `11` è nel sistema binario, o in base 2. Questo esempio converte la stringa `11` in un intero `3`.
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
index ded630df7a..3d11acc508 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
@@ -12,7 +12,7 @@ dashedName: use-the-parseint-function
La funzione `parseInt()` analizza una stringa e restituisce un numero intero. Ecco un esempio:
```js
-var a = parseInt("007");
+const a = parseInt("007");
```
La funzione di cui sopra converte la stringa `007` nell'intero `7`. Se il primo carattere della stringa non può essere convertito in un numero, restituisce `NaN`.
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
index f238d440ba..bc280c8f39 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
@@ -14,7 +14,7 @@ Gli oggetti possono essere pensati come una memorizzazione di coppie chiave / va
Ecco l'esempio di una semplice ricerca in un alfabeto inverso:
```js
-var alpha = {
+const alpha = {
1:"Z",
2:"Y",
3:"X",
@@ -24,10 +24,11 @@ var alpha = {
25:"B",
26:"A"
};
+
alpha[2];
alpha[24];
-var value = 2;
+const value = 2;
alpha[value];
```
@@ -102,7 +103,7 @@ assert(
```js
// Setup
function phoneticLookup(val) {
- var result = "";
+ let result = "";
// Only change code below this line
switch(val) {
@@ -136,9 +137,9 @@ phoneticLookup("charlie");
```js
function phoneticLookup(val) {
- var result = "";
+ let result = "";
- var lookup = {
+ const lookup = {
alpha: "Adams",
bravo: "Boston",
charlie: "Chicago",
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
index b358f58679..96e39636aa 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
@@ -16,7 +16,7 @@ In un gioco "Mad Libs" ti vengono fornite frasi con alcune parole mancanti, come
Considera questa frase: It was really **\_\_\_\_**, and we **\_\_\_\_** ourselves **\_\_\_\_**. Questa frase ha tre parti mancanti - un aggettivo, un verbo e un avverbio, e possiamo aggiungere parole di nostra scelta per completarla. Possiamo quindi assegnare la frase completata a una variabile come segue:
```js
-var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
+const sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
```
# --instructions--
@@ -84,24 +84,24 @@ const removeAssignments = str => str
## --seed-contents--
```js
-var myNoun = "dog";
-var myAdjective = "big";
-var myVerb = "ran";
-var myAdverb = "quickly";
+const myNoun = "dog";
+const myAdjective = "big";
+const myVerb = "ran";
+const myAdverb = "quickly";
// Only change code below this line
-var wordBlanks = ""; // Change this line
+const wordBlanks = ""; // Change this line
// Only change code above this line
```
# --solutions--
```js
-var myNoun = "dog";
-var myAdjective = "big";
-var myVerb = "ran";
-var myAdverb = "quickly";
+const myNoun = "dog";
+const myAdjective = "big";
+const myVerb = "ran";
+const myAdverb = "quickly";
-var wordBlanks = "Once there was a " + myNoun + " which was very " + myAdjective + ". ";
+let wordBlanks = "Once there was a " + myNoun + " which was very " + myAdjective + ". ";
wordBlanks += "It " + myVerb + " " + myAdverb + " around the yard.";
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
index 78b0ae1d53..8f8ef090d2 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
@@ -8,11 +8,13 @@ dashedName: compare-scopes-of-the-var-and-let-keywords
# --description--
+Se non hai familiarità con `let`, guarda [questa sfida](/italian/learn/javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords).
+
Quando si dichiara una variabile con la parola chiave `var`, essa viene dichiarata globalmente, o localmente se dichiarata all'interno di una funzione.
La parola chiave `let` si comporta allo stesso modo, ma con alcune funzioni extra. Quando si dichiara una variabile con la parola chiave `let` all'interno di un blocco, di una dichiarazione o di un'espressione, il suo ambito di applicazione è limitato a tale blocco, dichiarazione o espressione.
-Ad esempio:
+Per esempio:
```js
var numArray = [];
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
index 90afce5d3b..584d9b959e 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
@@ -8,6 +8,8 @@ dashedName: mutate-an-array-declared-with-const
# --description--
+Se non hai familiarità con `const`, guarda [questa sfida](/italian/learn/javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword).
+
La dichiarazione `const` ha molti casi di utilizzo nel JavaScript moderno.
Alcuni sviluppatori preferiscono assegnare tutte le loro variabili usando `const` come impostazione predefinita, a meno che non sappiano che dovranno riassegnare il valore. Solo in quel caso usano `let`.
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
index ec106d4bad..7de60422fe 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
@@ -13,7 +13,7 @@ La programmazione funzionale riguarda la creazione e l'utilizzo di funzioni non
L'ultima sfida ha introdotto il metodo `concat` come modo per combinare degli array in uno nuovo senza mutare gli array originali. Confronta `concat` con il metodo `push`. `push` aggiunge un elemento alla fine dello stesso array sul quale viene richiamato, mutando quello stesso array. Ecco un esempio:
```js
-var arr = [1, 2, 3];
+const arr = [1, 2, 3];
arr.push([4, 5, 6]);
```
@@ -71,8 +71,9 @@ function nonMutatingPush(original, newItem) {
// Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
+
+const first = [1, 2, 3];
+const second = [4, 5];
nonMutatingPush(first, second);
```
@@ -82,7 +83,6 @@ nonMutatingPush(first, second);
function nonMutatingPush(original, newItem) {
return original.concat(newItem);
}
-var first = [1, 2, 3];
-var second = [4, 5];
-nonMutatingPush(first, second);
+const first = [1, 2, 3];
+const second = [4, 5];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
index b17658cb35..0be730b16e 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
@@ -77,7 +77,6 @@ function urlSlug(title) {
# --solutions--
```js
-// Only change code below this line
function urlSlug(title) {
return title.trim().split(/\s+/).join("-").toLowerCase();
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
index 4c05d5ff64..d3aabcc8b0 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
@@ -57,9 +57,9 @@ La tua funzione `incrementer` dovrebbe restituire un valore basato sul valore de
```js
// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
-function incrementer () {
+function incrementer() {
// Only change code below this line
@@ -70,7 +70,7 @@ function incrementer () {
# --solutions--
```js
-var fixedValue = 4
+let fixedValue = 4
function incrementer() {
return fixedValue + 1
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
index 8cbb8ed9d9..276483c0d6 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
@@ -13,8 +13,8 @@ Il metodo `join` viene utilizzato per unire gli elementi di un array per creare
Ecco un esempio:
```js
-var arr = ["Hello", "World"];
-var str = arr.join(" ");
+const arr = ["Hello", "World"];
+const str = arr.join(" ");
```
`str` conterrà la stringa `Hello World`.
@@ -76,6 +76,7 @@ function sentensify(str) {
// Only change code above this line
}
+
sentensify("May-the-force-be-with-you");
```
@@ -83,8 +84,6 @@ sentensify("May-the-force-be-with-you");
```js
function sentensify(str) {
- // Only change code below this line
return str.split(/\W/).join(' ');
- // Only change code above this line
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
index 2e670d61e9..9080414f5b 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
@@ -60,8 +60,9 @@ function nonMutatingConcat(original, attach) {
// Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
+
+const first = [1, 2, 3];
+const second = [4, 5];
nonMutatingConcat(first, second);
```
@@ -69,11 +70,8 @@ nonMutatingConcat(first, second);
```js
function nonMutatingConcat(original, attach) {
- // Only change code below this line
return original.concat(attach);
- // Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
-nonMutatingConcat(first, second);
+const first = [1, 2, 3];
+const second = [4, 5];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
index 7481fe5ad4..f86c26fd5a 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
@@ -38,17 +38,17 @@ assert(!code.match(/\.?[\s\S]*?map/g));
```js
// The global variable
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myMap = function(callback) {
- var newArray = [];
+ const newArray = [];
// Only change code below this line
// Only change code above this line
return newArray;
};
-var new_s = s.myMap(function(item) {
+const new_s = s.myMap(function(item) {
return item * 2;
});
```
@@ -56,20 +56,17 @@ var new_s = s.myMap(function(item) {
# --solutions--
```js
-// the global Array
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myMap = function(callback) {
- var newArray = [];
- // Only change code below this line
- for (var elem of this) {
+ const newArray = [];
+ for (const elem of this) {
newArray.push(callback(elem));
}
- // Only change code above this line
return newArray;
};
-var new_s = s.myMap(function(item) {
+const new_s = s.myMap(function(item) {
return item * 2;
});
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
index 0ac91d4557..be2cd8f1b8 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
@@ -34,16 +34,16 @@ assert(!code.match(/\.?[\s\S]*?filter/g));
```js
// The global variable
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback) {
// Only change code below this line
- var newArray = [];
+ const newArray = [];
// Only change code above this line
return newArray;
};
-var new_s = s.myFilter(function(item) {
+const new_s = s.myFilter(function(item) {
return item % 2 === 1;
});
```
@@ -51,20 +51,17 @@ var new_s = s.myFilter(function(item) {
# --solutions--
```js
-// the global Array
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback) {
- var newArray = [];
- // Only change code below this line
+ const newArray = [];
for (let i = 0; i < this.length; i++) {
if (callback(this[i])) newArray.push(this[i]);
}
- // Only change code above this line
return newArray;
};
-var new_s = s.myFilter(function(item) {
+const new_s = s.myFilter(function(item) {
return item % 2 === 1;
});
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
index 08b0f55094..a16389a119 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
@@ -35,7 +35,7 @@ curried(1)(2)
Questo sarà utile nel tuo programma se non sarai in grado di fornire tutti gli argomenti ad una funzione in una sola volta. Potrai salvare ogni chiamata di funzione in una variabile, che manterrà il riferimento alla funzione restituita, che prenderà l'argomento successivo quando sarà disponibile. Ecco un esempio usando la funzione curried dell'esempio visto sopra:
```js
-var funcForY = curried(1);
+const funcForY = curried(1);
console.log(funcForY(2)); // 3
```
@@ -45,7 +45,8 @@ Allo stesso modo, l'applicazione parziale può essere descritta come
function impartial(x, y, z) {
return x + y + z;
}
-var partialFn = impartial.bind(this, 1, 2);
+
+const partialFn = impartial.bind(this, 1, 2);
partialFn(10); // 13
```
@@ -90,6 +91,7 @@ function add(x) {
// Only change code above this line
}
+
add(10)(20)(30);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
index abbc1b478f..593d57dbe9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
@@ -53,10 +53,10 @@ assert(__newValue === 5);
```js
// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
// Only change code below this line
-function incrementer () {
+function incrementer() {
// Only change code above this line
@@ -66,15 +66,9 @@ function incrementer () {
# --solutions--
```js
-// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
-// Only change code below this line
-function incrementer (fixedValue) {
+function incrementer(fixedValue) {
return fixedValue + 1;
-
- // Only change code above this line
}
-
-
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
index ac1d10eac0..0f1f353bd3 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
@@ -10,7 +10,7 @@ dashedName: refactor-global-variables-out-of-functions
Finora abbiamo visto due principi distinti per la programmazione funzionale:
-1) Non modificare una variabile o un oggetto - se necessario creare nuove variabili e oggetti e restituirli da una funzione. Suggerimento: usando qualcosa come `var newArr = arrVar`, dove `arrVar` è un array, creerai semplicemente un riferimento alla variabile esistente e non una copia. Quindi cambiando un valore in `newArr` cambierà anche il valore in `arrVar`.
+1) Non modificare una variabile o un oggetto - se necessario creare nuove variabili e oggetti e restituirli da una funzione. Suggerimento: usando qualcosa come `const newArr = arrVar`, dove `arrVar` è un array, creerai semplicemente un riferimento alla variabile esistente e non una copia. Quindi cambiando un valore in `newArr` cambierà anche il valore in `arrVar`.
2) Dichiarare i parametri della funzione - qualsiasi calcolo all'interno di una funzione deve dipendere solo dagli argomenti passati alla funzione, e non da qualsiasi oggetto o variabile globale.
@@ -86,7 +86,7 @@ assert(
```js
// The global variable
-var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
+const bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
// Change code below this line
function add (bookName) {
@@ -99,7 +99,7 @@ function add (bookName) {
// Change code below this line
function remove (bookName) {
- var book_index = bookList.indexOf(bookName);
+ const book_index = bookList.indexOf(bookName);
if (book_index >= 0) {
bookList.splice(book_index, 1);
@@ -109,9 +109,9 @@ function remove (bookName) {
}
}
-var newBookList = add(bookList, 'A Brief History of Time');
-var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
-var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
+const newBookList = add(bookList, 'A Brief History of Time');
+const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
+const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
console.log(bookList);
```
@@ -120,13 +120,13 @@ console.log(bookList);
```js
// The global variable
-var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
+const bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
-function add (bookList, bookName) {
+function add(bookList, bookName) {
return [...bookList, bookName];
}
-function remove (bookList, bookName) {
+function remove(bookList, bookName) {
const bookListCopy = [...bookList];
const bookNameIndex = bookList.indexOf(bookName);
if (bookNameIndex >= 0) {
@@ -135,7 +135,7 @@ function remove (bookList, bookName) {
return bookListCopy;
}
-var newBookList = add(bookList, 'A Brief History of Time');
-var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
-var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
+const newBookList = add(bookList, 'A Brief History of Time');
+const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
+const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
index 98ba6cd7ea..42204ce06e 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
@@ -11,7 +11,7 @@ dashedName: remove-elements-from-an-array-using-slice-instead-of-splice
Un'operazione che si fa comunemente lavorando con gli array è quella di rimuovere degli elemento mantenendo il resto dell'array. A questo scopo JavaScript offre il metodo `splice`, che richiede degli argomenti per la posizione (indice) di dove iniziare a rimuovere gli elementi, e per il numero di elementi da rimuovere. Se il secondo argomento non è fornito, il comportamento predefinito è quello di rimuovere gli elementi fino alla fine. Tuttavia, il metodo `splice` muta l'array originale su cui viene chiamato. Ecco un esempio:
```js
-var cities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
+const cities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
cities.splice(3, 1);
```
@@ -69,7 +69,8 @@ function nonMutatingSplice(cities) {
// Only change code above this line
}
-var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
+
+const inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
nonMutatingSplice(inputCities);
```
@@ -77,10 +78,7 @@ nonMutatingSplice(inputCities);
```js
function nonMutatingSplice(cities) {
- // Only change code below this line
return cities.slice(0,3);
- // Only change code above this line
}
-var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
-nonMutatingSplice(inputCities);
+const inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
index c68e75beab..41dd0b004c 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
@@ -68,24 +68,23 @@ assert(JSON.stringify(nonMutatingSort([140000, 104, 99])) ===
## --seed-contents--
```js
-var globalArray = [5, 6, 3, 2, 9];
+const globalArray = [5, 6, 3, 2, 9];
+
function nonMutatingSort(arr) {
// Only change code below this line
// Only change code above this line
}
+
nonMutatingSort(globalArray);
```
# --solutions--
```js
-var globalArray = [5, 6, 3, 2, 9];
+const globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
- // Only change code below this line
return [].concat(arr).sort((a,b) => a-b);
- // Only change code above this line
}
-nonMutatingSort(globalArray);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
index 100adb00ac..7334fcec52 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
@@ -13,8 +13,8 @@ Il metodo `slice` restituisce una copia di alcuni elementi di un array. Può pre
Ecco un esempio:
```js
-var arr = ["Cat", "Dog", "Tiger", "Zebra"];
-var newArray = arr.slice(1, 3);
+const arr = ["Cat", "Dog", "Tiger", "Zebra"];
+const newArray = arr.slice(1, 3);
```
`newArray` avrà il valore `["Dog", "Tiger"]`.
@@ -78,7 +78,8 @@ function sliceArray(anim, beginSlice, endSlice) {
// Only change code above this line
}
-var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
+
+const inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
sliceArray(inputAnim, 1, 3);
```
@@ -86,10 +87,7 @@ sliceArray(inputAnim, 1, 3);
```js
function sliceArray(anim, beginSlice, endSlice) {
- // Only change code below this line
- return anim.slice(beginSlice, endSlice)
- // Only change code above this line
+ return anim.slice(beginSlice, endSlice);
}
-var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
-sliceArray(inputAnim, 1, 3);
+const inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
index ffda7234fe..5f20c74f67 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
@@ -18,6 +18,7 @@ function ascendingOrder(arr) {
return a - b;
});
}
+
ascendingOrder([1, 5, 2, 3, 4]);
```
@@ -29,6 +30,7 @@ function reverseAlpha(arr) {
return a === b ? 0 : a < b ? 1 : -1;
});
}
+
reverseAlpha(['l', 'h', 'z', 'b', 's']);
```
@@ -86,6 +88,7 @@ function alphabeticalOrder(arr) {
return arr
// Only change code above this line
}
+
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```
@@ -93,9 +96,6 @@ alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```js
function alphabeticalOrder(arr) {
- // Only change code below this line
return arr.sort();
- // Only change code above this line
}
-alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
index 1cdcb7b47a..4a9e267ca4 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
@@ -13,11 +13,11 @@ Il metodo `split` divide una stringa in un array di stringhe. Esso richiede un a
Ecco un esempio che divide una stringa in base agli spazi, poi un altro in base alle cifre facendo uso di un'espressione regolare:
```js
-var str = "Hello World";
-var bySpace = str.split(" ");
+const str = "Hello World";
+const bySpace = str.split(" ");
-var otherString = "How9are7you2today";
-var byDigits = otherString.split(/\d/);
+const otherString = "How9are7you2today";
+const byDigits = otherString.split(/\d/);
```
`bySpace` avrà il valore `["Hello", "World"]` e `byDigits` avrà il valore `["How", "are", "you", "today"]`.
@@ -74,6 +74,7 @@ function splitify(str) {
// Only change code above this line
}
+
splitify("Hello World,I-am code");
```
@@ -81,8 +82,6 @@ splitify("Hello World,I-am code");
```js
function splitify(str) {
- // Only change code below this line
return str.split(/\W/);
- // Only change code above this line
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
index 05be76d717..ce4c54fcf2 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
@@ -59,29 +59,29 @@ assert.deepEqual(finalTabs.tabs, [
```js
// tabs is an array of titles of each site open within the window
-var Window = function(tabs) {
+const Window = function(tabs) {
this.tabs = tabs; // We keep a record of the array inside the object
};
// When you join two windows into one window
-Window.prototype.join = function (otherWindow) {
+Window.prototype.join = function(otherWindow) {
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
};
// When you open a new tab at the end
-Window.prototype.tabOpen = function (tab) {
+Window.prototype.tabOpen = function(tab) {
this.tabs.push('new tab'); // Let's open a new tab for now
return this;
};
// When you close a tab
-Window.prototype.tabClose = function (index) {
+Window.prototype.tabClose = function(index) {
// Only change code below this line
- var tabsBeforeIndex = this.tabs.splice(0, index); // Get the tabs before the tab
- var tabsAfterIndex = this.tabs.splice(index + 1); // Get the tabs after the tab
+ const tabsBeforeIndex = this.tabs.splice(0, index); // Get the tabs before the tab
+ const tabsAfterIndex = this.tabs.splice(index + 1); // Get the tabs after the tab
this.tabs = tabsBeforeIndex.concat(tabsAfterIndex); // Join them together
@@ -91,12 +91,12 @@ Window.prototype.tabClose = function (index) {
};
// Let's create three browser windows
-var workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
-var socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
-var videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
+const workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
+const socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
+const videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
// Now perform the tab opening, closing, and other operations
-var finalTabs = socialWindow
+const finalTabs = socialWindow
.tabOpen() // Open a new tab for cat memes
.join(videoWindow.tabClose(2)) // Close third tab in video window, and join
.join(workWindow.tabClose(1).tabOpen());
@@ -106,40 +106,34 @@ console.log(finalTabs.tabs);
# --solutions--
```js
-// tabs is an array of titles of each site open within the window
-var Window = function(tabs) {
- this.tabs = tabs; // We keep a record of the array inside the object
+const Window = function(tabs) {
+ this.tabs = tabs;
};
-// When you join two windows into one window
-Window.prototype.join = function (otherWindow) {
+Window.prototype.join = function(otherWindow) {
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
};
-// When you open a new tab at the end
-Window.prototype.tabOpen = function (tab) {
- this.tabs.push('new tab'); // Let's open a new tab for now
+Window.prototype.tabOpen = function(tab) {
+ this.tabs.push('new tab');
return this;
};
-// When you close a tab
-Window.prototype.tabClose = function (index) {
- var tabsBeforeIndex = this.tabs.slice(0, index); // Get the tabs before the tab
- var tabsAfterIndex = this.tabs.slice(index + 1); // Get the tabs after the tab
+Window.prototype.tabClose = function(index) {
+ const tabsBeforeIndex = this.tabs.slice(0, index);
+ const tabsAfterIndex = this.tabs.slice(index + 1);
- this.tabs = tabsBeforeIndex.concat(tabsAfterIndex); // Join them together
+ this.tabs = tabsBeforeIndex.concat(tabsAfterIndex);
return this;
};
-// Let's create three browser windows
-var workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
-var socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
-var videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
+const workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']);
+const socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']);
+const videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']);
-// Now perform the tab opening, closing, and other operations
-var finalTabs = socialWindow
- .tabOpen() // Open a new tab for cat memes
- .join(videoWindow.tabClose(2)) // Close third tab in video window, and join
+const finalTabs = socialWindow
+ .tabOpen()
+ .join(videoWindow.tabClose(2))
.join(workWindow.tabClose(1).tabOpen());
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
index a0aa580e98..02cfc87dd5 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
@@ -13,7 +13,8 @@ Il metodo `every` funziona con gli array per controllare se *ogni* elemento supe
Ad esempio, il seguente codice controllerà se ogni elemento nell'array `numbers` è inferiore a 10:
```js
-var numbers = [1, 5, 8, 0, 10, 11];
+const numbers = [1, 5, 8, 0, 10, 11];
+
numbers.every(function(currentValue) {
return currentValue < 10;
});
@@ -62,6 +63,7 @@ function checkPositive(arr) {
// Only change code above this line
}
+
checkPositive([1, 2, 3, -4, 5]);
```
@@ -69,9 +71,6 @@ checkPositive([1, 2, 3, -4, 5]);
```js
function checkPositive(arr) {
- // Only change code below this line
return arr.every(num => num > 0);
- // Only change code above this line
}
-checkPositive([1, 2, 3, -4, 5]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
index 1806ad107d..d07c29105c 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
@@ -55,7 +55,7 @@ Il tuo codice non dovrebbe utilizzare un ciclo `for`.
assert(!code.match(/for\s*?\([\s\S]*?\)/g));
```
-`filteredList` dovrebbe essere uguale a `[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]`.
+`filteredList` dovrebbe essere uguale a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`.
```js
assert.deepEqual(filteredList, [
@@ -72,7 +72,7 @@ assert.deepEqual(filteredList, [
```js
// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -187,7 +187,7 @@ var watchList = [
// Only change code below this line
-var filteredList;
+const filteredList = "";
// Only change code above this line
@@ -197,8 +197,7 @@ console.log(filteredList);
# --solutions--
```js
-// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -311,7 +310,5 @@ var watchList = [
}
];
-// Only change code below this line
-let filteredList = watchList.filter(e => e.imdbRating >= 8).map( ({Title: title, imdbRating: rating}) => ({title, rating}) );
-// Only change code above this line
+const filteredList = watchList.filter(e => e.imdbRating >= 8).map( ({Title: title, imdbRating: rating}) => ({title, rating}) );
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
index 4560004153..5990cfeae4 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
@@ -61,7 +61,7 @@ Il tuo codice dovrebbe utilizzare il metodo `map`.
assert(code.match(/\.map/g));
```
-`ratings` dovrebbe essere uguale a `[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]`.
+`ratings` dovrebbe essere uguale a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`.
```js
assert.deepEqual(ratings, [
@@ -79,7 +79,7 @@ assert.deepEqual(ratings, [
```js
// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -194,9 +194,9 @@ var watchList = [
// Only change code below this line
-var ratings = [];
-for(var i=0; i < watchList.length; i++){
- ratings.push({title: watchList[i]["Title"], rating: watchList[i]["imdbRating"]});
+const ratings = [];
+for (let i = 0; i < watchList.length; i++) {
+ ratings.push({title: watchList[i]["Title"], rating: watchList[i]["imdbRating"]});
}
// Only change code above this line
@@ -207,8 +207,7 @@ console.log(JSON.stringify(ratings));
# --solutions--
```js
-// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -321,7 +320,7 @@ var watchList = [
}
];
-var ratings = watchList.map(function(movie) {
+const ratings = watchList.map(function(movie) {
return {
title: movie["Title"],
rating: movie["imdbRating"]
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
index b099d5bde6..fefae672b9 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
@@ -93,7 +93,7 @@ assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
```js
// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -206,22 +206,22 @@ var watchList = [
}
];
-function getRating(watchList){
+function getRating(watchList) {
// Only change code below this line
- var averageRating;
+ let averageRating;
// Only change code above this line
return averageRating;
}
+
console.log(getRating(watchList));
```
# --solutions--
```js
-// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -334,8 +334,8 @@ var watchList = [
}
];
-function getRating(watchList){
- var averageRating;
+function getRating(watchList) {
+ let averageRating;
const rating = watchList
.filter(obj => obj.Director === "Christopher Nolan")
.map(obj => Number(obj.imdbRating));
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
index 4463777602..6e40098e44 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
@@ -13,7 +13,8 @@ Il metodo `some` funziona con gli array per verificare se *un qualunque* element
Ad esempio, il seguente codice controllerà se almeno un elemento nell'array `numbers` è inferiore a 10:
```js
-var numbers = [10, 50, 8, 220, 110, 11];
+const numbers = [10, 50, 8, 220, 110, 11];
+
numbers.some(function(currentValue) {
return currentValue < 10;
});
@@ -62,6 +63,7 @@ function checkPositive(arr) {
// Only change code above this line
}
+
checkPositive([1, 2, 3, -4, 5]);
```
@@ -69,9 +71,6 @@ checkPositive([1, 2, 3, -4, 5]);
```js
function checkPositive(arr) {
- // Only change code below this line
return arr.some(elem => elem > 0);
- // Only change code above this line
}
-checkPositive([1, 2, 3, -4, 5]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
index 5d6f36636e..8c51c56de1 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
@@ -157,7 +157,7 @@ assert(diffArray([1, 'calf', 3, 'piglet'], [7, 'filly']).length === 6);
```js
function diffArray(arr1, arr2) {
- var newArr = [];
+ const newArr = [];
return newArr;
}
@@ -168,13 +168,12 @@ diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
```js
function diffArray(arr1, arr2) {
- var newArr = [];
- var h1 = Object.create(null);
+ const newArr = [];
+ const h1 = Object.create(null);
arr1.forEach(function(e) {
h1[e] = e;
});
-
- var h2 = Object.create(null);
+ const h2 = Object.create(null);
arr2.forEach(function(e) {
h2[e] = e;
});
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
index 63db2d40aa..29d39ca009 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
@@ -23,10 +23,19 @@ Esegui i test per vedere l'output atteso per ogni metodo. I metodi che prendono
# --hints--
-`Object.keys(bob).length` dovrebbe restituire 6.
+Nessuna proprietà dovrebbe essere aggiunta. `Object.keys(bob).length` dovrebbe sempre restituire 6.
```js
-assert.deepEqual(Object.keys(bob).length, 6);
+assert.strictEqual(
+ Object.keys((function () {
+ let bob = new Person('Bob Ross');
+ bob.setFirstName('Haskell');
+ bob.setLastName('Curry');
+ bob.setFullName('John Smith');
+ return bob;
+ })()).length,
+ 6
+ );
```
`bob instanceof Person` dovrebbe restituire `true`.
@@ -139,7 +148,7 @@ if(bob){
## --seed-contents--
```js
-var Person = function(firstAndLast) {
+const Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
this.getFullName = function() {
@@ -148,16 +157,16 @@ var Person = function(firstAndLast) {
return firstAndLast;
};
-var bob = new Person('Bob Ross');
+const bob = new Person('Bob Ross');
bob.getFullName();
```
# --solutions--
```js
-var Person = function(firstAndLast) {
+const Person = function(firstAndLast) {
- var firstName, lastName;
+ let firstName, lastName;
function updateName(str) {
firstName = str.split(" ")[0];
@@ -192,6 +201,6 @@ var Person = function(firstAndLast) {
};
};
-var bob = new Person('Bob Ross');
+const bob = new Person('Bob Ross');
bob.getFullName();
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
index 001fc277e2..5aafa241b3 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
@@ -51,8 +51,8 @@ assert.deepEqual(
```js
function orbitalPeriod(arr) {
- var GM = 398600.4418;
- var earthRadius = 6367.4447;
+ const GM = 398600.4418;
+ const earthRadius = 6367.4447;
return arr;
}
@@ -63,9 +63,9 @@ orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
```js
function orbitalPeriod(arr) {
- var GM = 398600.4418;
- var earthRadius = 6367.4447;
- var TAU = 2 * Math.PI;
+ const GM = 398600.4418;
+ const earthRadius = 6367.4447;
+ const TAU = 2 * Math.PI;
return arr.map(function(obj) {
return {
name: obj.name,
@@ -73,6 +73,4 @@ function orbitalPeriod(arr) {
};
});
}
-
-orbitalPeriod([{name : "sputkin", avgAlt : 35873.5553}]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
index 03879b19f4..5a26b6e01b 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
@@ -61,7 +61,6 @@ function smallestCommons(arr) {
return arr;
}
-
smallestCommons([1,5]);
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
index c74446657e..9064b93e5d 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
@@ -103,7 +103,7 @@ assert.deepEqual(
```js
function whatIsInAName(collection, source) {
- var arr = [];
+ const arr = [];
// Only change code below this line
@@ -118,8 +118,8 @@ whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last:
```js
function whatIsInAName(collection, source) {
- var arr = [];
- var keys = Object.keys(source);
+ const arr = [];
+ const keys = Object.keys(source);
collection.forEach(function(e) {
if(keys.every(function(key) {return e[key] === source[key];})) {
arr.push(e);
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
index aee75cf077..788ac0d982 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
@@ -51,7 +51,6 @@ assert(
```js
function rot13(str) {
-
return str;
}
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
index 1910e938ac..8896cc86f4 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
@@ -186,7 +186,7 @@ assert.deepEqual(
```js
function checkCashRegister(price, cash, cid) {
- var change;
+ let change;
return change;
}
@@ -196,54 +196,57 @@ checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], [
# --solutions--
```js
-var denom = [
- { name: 'ONE HUNDRED', val: 100},
- { name: 'TWENTY', val: 20},
- { name: 'TEN', val: 10},
- { name: 'FIVE', val: 5},
- { name: 'ONE', val: 1},
- { name: 'QUARTER', val: 0.25},
- { name: 'DIME', val: 0.1},
- { name: 'NICKEL', val: 0.05},
- { name: 'PENNY', val: 0.01}
+const denom = [
+ { name: "ONE HUNDRED", val: 100 },
+ { name: "TWENTY", val: 20 },
+ { name: "TEN", val: 10 },
+ { name: "FIVE", val: 5 },
+ { name: "ONE", val: 1 },
+ { name: "QUARTER", val: 0.25 },
+ { name: "DIME", val: 0.1 },
+ { name: "NICKEL", val: 0.05 },
+ { name: "PENNY", val: 0.01 },
];
function checkCashRegister(price, cash, cid) {
- var output = {status: null, change: []};
- var change = cash - price;
- var register = cid.reduce(function(acc, curr) {
- acc.total += curr[1];
- acc[curr[0]] = curr[1];
- return acc;
- }, {total: 0});
- if(register.total === change) {
- output.status = 'CLOSED';
- output.change = cid;
- return output;
- }
- if(register.total < change) {
- output.status = 'INSUFFICIENT_FUNDS';
- return output;
- }
- var change_arr = denom.reduce(function(acc, curr) {
- var value = 0;
- while(register[curr.name] > 0 && change >= curr.val) {
- change -= curr.val;
- register[curr.name] -= curr.val;
- value += curr.val;
- change = Math.round(change * 100) / 100;
- }
- if(value > 0) {
- acc.push([ curr.name, value ]);
- }
- return acc;
- }, []);
- if(change_arr.length < 1 || change > 0) {
- output.status = 'INSUFFICIENT_FUNDS';
- return output;
- }
- output.status = 'OPEN';
- output.change = change_arr;
- return output;
+ const output = { status: null, change: [] };
+ let change = cash - price;
+ const register = cid.reduce(
+ function (acc, curr) {
+ acc.total += curr[1];
+ acc[curr[0]] = curr[1];
+ return acc;
+ },
+ { total: 0 }
+ );
+ if (register.total === change) {
+ output.status = "CLOSED";
+ output.change = cid;
+ return output;
+ }
+ if (register.total < change) {
+ output.status = "INSUFFICIENT_FUNDS";
+ return output;
+ }
+ const change_arr = denom.reduce(function (acc, curr) {
+ let value = 0;
+ while (register[curr.name] > 0 && change >= curr.val) {
+ change -= curr.val;
+ register[curr.name] -= curr.val;
+ value += curr.val;
+ change = Math.round(change * 100) / 100;
+ }
+ if (value > 0) {
+ acc.push([curr.name, value]);
+ }
+ return acc;
+ }, []);
+ if (change_arr.length < 1 || change > 0) {
+ output.status = "INSUFFICIENT_FUNDS";
+ return output;
+ }
+ output.status = "OPEN";
+ output.change = change_arr;
+ return output;
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
index 6d4161dd77..61b1c1ab41 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
@@ -107,8 +107,6 @@ function palindrome(str) {
return true;
}
-
-
palindrome("eye");
```
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md b/curriculum/challenges/italian/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
index 12727866b5..85f1049c60 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
@@ -22,7 +22,7 @@ Puoi utilizzare qualsiasi mix di HTML, JavaScript, CSS, Bootstrap, SASS, React,
**User Story #4:** Quando inserisco markdown in stile GitHub nell'elemento `#editor`, il testo viene presentato come HTML nell'elemento `#preview` mentre digito (SUGGERIMENTO: Non è necessario che analizzi tu stesso il Markdown - puoi importare la libreria Marked per questo: [https://cdnjs. om/libraries/marked](https://cdnjs.com/libraries/marked)).
-**User Story #5:** Quando il mio visualizzatore di markdown viene caricato inizialmente, il testo predefinito nel campo `#editor` dovrebbe contenere markdown valido che rappresenti almeno uno dei seguenti elementi: un'intestazione (dimensione H1), una sotto-intestazione (formato H2), un collegamento, del codice in linea, un blocco di codice, un elemento lista, un blockquote, un'immagine e un testo in grassetto.
+**User Story #5:** Quando il mio visualizzatore di markdown viene caricato inizialmente, il testo predefinito nel campo `#editor` dovrebbe contenere del markdown valido che rappresenti almeno uno dei seguenti elementi: un'intestazione (dimensione H1), una sotto-intestazione (formato H2), un collegamento, del codice in linea, un blocco di codice, un elemento di lista, un blockquote, un'immagine e un testo in grassetto.
**User Story #6:** Quando il mio visualizzatore di markdown viene caricato inizialmente, il markdown predefinito nel campo `#editor` dovrebbe essere presentato come HTML nell'elemento `#preview`.
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/react/access-props-using-this.props.md b/curriculum/challenges/italian/03-front-end-development-libraries/react/access-props-using-this.props.md
index 941b8bf6a0..6e06494d7d 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/react/access-props-using-this.props.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/react/access-props-using-this.props.md
@@ -14,67 +14,54 @@ Ogni volta che fai riferimento a un componente di classe all'interno di sé stes
# --instructions--
-Mostra un'istanza del componente `ReturnTempPassword` nel componente genitore `ResetPassword`. Qui, dai a `ReturnTempPassword` una prop di `tempPassword` e assegnale un valore stringa di almeno 8 caratteri. All'interno del figlio, `ReturnTempPassword`, accedi alla prop `tempPassword` all'interno dei tag `strong` per assicurarti che l'utente veda la password temporanea.
+Mostra un'istanza del componente `Welcome` nel componente genitore `App`. Qui, dai a `Welcome` una proprietà di `name` e assegnale il valore di una stringa. Dentro il componente figlio, `Welcome`, accedi alla proprietà `name` dentro le tag `strong`.
# --hints--
-Il componente `ResetPassword` dovrebbe restituire un singolo elemento `div`.
+Il componente `App` dovrebbe restituire un singolo elemento `div`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return mockedComponent.children().type() === 'div';
})()
);
```
-Il quarto figlio di `ResetPassword` dovrebbe essere il componente `ReturnTempPassword`.
+Il figlio di `App` dovrebbe essere il componente `Welcome`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return (
- mockedComponent.children().childAt(3).name() === 'ReturnTempPassword'
+ mockedComponent.children().childAt(0).name() === 'Welcome'
);
})()
);
```
-Il componente `ReturnTempPassword` dovrebbe avere una prop chiamata `tempPassword`.
+Il componente `Welcome` dovrebbe avere una prop chiamata `name`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
- return mockedComponent.find('ReturnTempPassword').props().tempPassword;
+ const mockedComponent = Enzyme.mount(React.createElement(App));
+ return mockedComponent.find('Welcome').props().name;
})()
);
```
-L'elemento `tempPassword` di `ReturnTempPassword` dovrebbe essere uguale a una stringa di almeno 8 caratteri.
+Il componente `Welcome` dovrebbe visualizzare la stringa che crei come prop `name` all'interno dei tag `strong`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
- const temp = mockedComponent.find('ReturnTempPassword').props()
- .tempPassword;
- return typeof temp === 'string' && temp.length >= 8;
- })()
-);
-```
-
-Il componente `ReturnTempPassword` dovrebbe visualizzare la password che crei come prop `tempPassword` all'interno dei tag `strong`.
-
-```js
-assert(
- (function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return (
mockedComponent.find('strong').text() ===
- mockedComponent.find('ReturnTempPassword').props().tempPassword
+ mockedComponent.find('Welcome').props().name
);
})()
);
@@ -85,13 +72,13 @@ assert(
## --after-user-code--
```jsx
-ReactDOM.render(, document.getElementById('root'))
+ReactDOM.render(, document.getElementById('root'))
```
## --seed-contents--
```jsx
-class ReturnTempPassword extends React.Component {
+class App extends React.Component {
constructor(props) {
super(props);
@@ -100,14 +87,14 @@ class ReturnTempPassword extends React.Component {
return (
{ /* Change code below this line */ }
-
Your temporary password is:
+
{ /* Change code above this line */ }
);
}
};
-class ResetPassword extends React.Component {
+class Welcome extends React.Component {
constructor(props) {
super(props);
@@ -115,11 +102,8 @@ class ResetPassword extends React.Component {
render() {
return (
-
Reset Password
-
We've generated a new temporary password for you.
-
Please reset this password from your account settings ASAP.
{ /* Change code below this line */ }
-
+
Hello, !
{ /* Change code above this line */ }
);
@@ -130,7 +114,7 @@ class ResetPassword extends React.Component {
# --solutions--
```jsx
-class ReturnTempPassword extends React.Component {
+class Welcome extends React.Component {
constructor(props) {
super(props);
@@ -138,28 +122,27 @@ class ReturnTempPassword extends React.Component {
render() {
return (
-
Your temporary password is: {this.props.tempPassword}
-
- );
- }
-};
-
-class ResetPassword extends React.Component {
- constructor(props) {
- super(props);
-
- }
- render() {
- return (
-
-
Reset Password
-
We've generated a new temporary password for you.
-
Please reset this password from your account settings ASAP.
{ /* Change code below this line */ }
-
+
Hello, {this.props.name}!
{ /* Change code above this line */ }
);
}
};
+
+class App extends React.Component {
+ constructor(props) {
+ super(props);
+
+ }
+ render() {
+ return (
+
+ { /* Change code below this line */ }
+
+ { /* Change code above this line */ }
+
+ );
+ }
+};
```
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-controlled-form.md b/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-controlled-form.md
index fb7db4bdf3..80dce6a868 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-controlled-form.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-controlled-form.md
@@ -109,7 +109,7 @@ assert(
);
```
-L'intestazione `h1` dovrebbe fare il render del valore del campo `submit` prendendolo dallo stato del componente.
+L'elemento di intestazione `h1` dovrebbe fare il render del valore del campo `submit` prendendolo dallo stato del componente.
```js
(() => {
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-react-component.md b/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-react-component.md
index 94c7c82f24..dc591f40f6 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-react-component.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/react/create-a-react-component.md
@@ -38,7 +38,7 @@ Il componente React dovrebbe restituire un elemento `div`.
assert(Enzyme.shallow(React.createElement(MyComponent)).type() === 'div');
```
-Il `div` restituito dovrebbe fare il render di un header `h1` al suo interno.
+Il `div` restituito dovrebbe fare il render di un elemento di intestazione `h1` al suo interno.
```js
assert(
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md b/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
index f23ecdd208..2026018671 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
@@ -27,7 +27,7 @@ assert(
);
```
-`MyComponent` dovrebbe presentare un'intestazione `h1` racchiusa in un singolo `div`.
+`MyComponent` dovrebbe presentare un elemento di intestazione `h1` racchiusa in un singolo `div`.
```js
assert(
diff --git a/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface.md b/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
index 9ff712bae4..6913dd27e0 100644
--- a/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
+++ b/curriculum/challenges/italian/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
@@ -33,7 +33,7 @@ assert(
);
```
-`MyComponent` dovrebbe presentare un'intestazione `h1` racchiusa in un singolo `div`.
+`MyComponent` dovrebbe presentare un elemento di intestazione `h1` racchiusa in un singolo `div`.
```js
assert(
diff --git a/curriculum/challenges/italian/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md b/curriculum/challenges/italian/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
index 35036315de..11ce41eb97 100644
--- a/curriculum/challenges/italian/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
+++ b/curriculum/challenges/italian/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
@@ -22,6 +22,8 @@ Poi, nel gestore della rotta GET `/json` che hai creato nell'ultima sfida, trasf
**Nota:** Se stai usando Replit, non puoi creare un file `.env`. Utilizza invece la scheda SECRETS integrata per aggiungere la variabile.
+Se stai lavorando in locale, avrai bisogno del pacchetto `dotenv`. Carica le variabili ambientali dal tuo file `.env` in `process.env`. Installalo con `npm install dotenv`. Quindi, in cima al tuo file `myApp.js`, importa e carica le variabili con `require('dotenv').config()`.
+
# --hints--
La risposta dell'endpoint `/json` dovrebbe cambiare in base alla variabile d'ambiente `MESSAGE_STYLE`
diff --git a/curriculum/challenges/italian/09-information-security/information-security-projects/stock-price-checker.md b/curriculum/challenges/italian/09-information-security/information-security-projects/stock-price-checker.md
index d3ca92e390..6d919bad07 100644
--- a/curriculum/challenges/italian/09-information-security/information-security-projects/stock-price-checker.md
+++ b/curriculum/challenges/italian/09-information-security/information-security-projects/stock-price-checker.md
@@ -27,6 +27,8 @@ Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospi
3. Aggiungerai tutte le funzionalità di sicurezza a `server.js`
4. Creerai tutti i test funzionali in `tests/2_functional-tests.js`
+**Nota** Considerazioni sulla privacy: a causa del requisito che solo 1 like per IP dovrebbe essere accettato, è necessario salvare gli indirizzi IP. È importante mantenere il rispetto delle leggi sulla privacy dei dati come il General Data Protection Regulation. Una opzione è quella di ottenere il permesso di salvare i dati dell'utente, ma è molto più semplice anonimizzarlo. Per questa sfida, ricordati di anonimizzare gli indirizzi IP prima di salvarli nel database. Se hai bisogno di idee su come farlo, puoi scegliere di fare l'hash dei dati, troncare l'IP, o impostare parte dell'indirizzo IP a 0.
+
Scrivi i seguenti test in `tests/2_functional-tests.js`:
- Visualizzazione di un'azione: richiesta GET a `/api/stock-prices/`
@@ -37,7 +39,7 @@ Scrivi i seguenti test in `tests/2_functional-tests.js`:
# --hints--
-Puoi fornire il tuo progetto e non l'URL di esempio.
+È necessario fornire il proprio progetto, non l'URL di esempio.
```js
(getUserInput) => {
@@ -110,7 +112,7 @@ async (getUserInput) => {
};
```
-Tutti i 5 test funzionali sono completi e superati.
+Tutti i 5 test funzionali richiesti sono completi e superati.
```js
async (getUserInput) => {
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/breadth-first-search.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/breadth-first-search.md
index 1207024135..e6840ccd56 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/breadth-first-search.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/breadth-first-search.md
@@ -8,31 +8,31 @@ dashedName: breadth-first-search
# --description--
-So far, we've learned different ways of creating representations of graphs. What now? One natural question to have is what are the distances between any two nodes in the graph? Enter graph traversal algorithms.
+Finora, abbiamo imparato diversi modi per creare rappresentazioni di grafi. E adesso? Una domanda naturale da porsi è quali sono le distanze tra due nodi qualsiasi nel grafo? Qui entrano in gioco gli algoritmi di attraversamento di grafi.
-Traversal algorithms are algorithms to traverse or visit nodes in a graph. One type of traversal algorithm is the breadth-first search algorithm.
+Gli algoritmi di attraversamento sono algoritmi per attraversare o visitare nodi in un grafo. Un tipo di algoritmo di attraversamento è l'algoritmo Breadth-first Search (di ricerca in ampiezza).
-This algorithm starts at one node and visits all its neighbors that are one edge away. It then goes on to visit each of their neighbors and so on until all nodes have been reached.
+Questo algoritmo inizia da un nodo e visita tutti i suoi vicini che sono ad un arco di distanza. Poi continua a visitare ciascuno dei loro vicini e così via fino a quando tutti i nodi sono stati raggiunti.
-An important data structure that will help implement the breadth-first search algorithm is the queue. This is an array where you can add elements to one end and remove elements from the other end. This is also known as a FIFO or First-In-First-Out data structure.
+Una struttura dati importante che aiuterà ad implementare l'algoritmo di ricerca in ampiezza è la coda. Questa è un array dove è possibile aggiungere elementi ad una estremità e rimuovere elementi dall'altra estremità. Essa è nota anche come una struttura di dati FIFO o First-In-First-Out (NdT: il primo a entrare è il primo a uscire).
-Visually, this is what the algorithm is doing. 
+Visualmente, questo è ciò che l'algoritmo sta facendo. 
-The grey shading represents a node getting added into the queue and the black shading represents a node getting removed from the queue. See how every time a node gets removed from the queue (node turns black), all their neighbors get added into the queue (node turns grey).
+L'ombreggiatura grigia rappresenta un nodo che viene aggiunto alla coda e l'ombreggiatura nera rappresenta un nodo che viene rimosso dalla coda. Vedi come ogni volta che un nodo viene rimosso dalla coda (il nodo diventa nero), tutti i vicini vengono aggiunti alla coda (il nodo diventa grigio).
-To implement this algorithm, you'll need to input a graph structure and a node you want to start at.
+Per implementare questo algoritmo, dovrai inserire una struttura grafo e un nodo da cui vuoi iniziare.
-First, you'll want to be aware of the distances from, or number of edges away from, the start node. You'll want to start all your distances with some large number, like `Infinity`. This prevents counting issues for when a node may not be reachable from your start node. Next, you'll want to go from the start node to its neighbors. These neighbors are one edge away and at this point you should add one unit of distance to the distances you're keeping track of.
+Innanzitutto, dovrai essere consapevole delle distanze (o del numero di archi di distanza) dal nodo iniziale. Ti consigliamo di inizializzare tutte le distanze con un numero elevato, come `Infinity`. Questo impedisce problemi di conteggio per quando un nodo potrebbe non essere raggiungibile dal nodo iniziale. Successivamente, vorrai andare dal nodo iniziale ai suoi vicini. Questi vicini sono a un arco di distanza e a questo punto dovresti aggiungere un'unità di distanza alle distanze di cui stai tenendo traccia.
# --instructions--
-Write a function `bfs()` that takes an adjacency matrix graph (a two-dimensional array) and a node label root as parameters. The node label will just be the integer value of the node between `0` and `n - 1`, where `n` is the total number of nodes in the graph.
+Scrivi una funzione `bfs()` che prende un grafo a matrice di adiacenza (un array bidimensionale) e l'etichetta di un nodo radice come parametri. L'etichetta del nodo sarà solo il valore intero del nodo tra `0` e `n - 1`, dove `n` è il numero totale di nodi nel grafico.
-Your function will output a JavaScript object key-value pairs with the node and its distance from the root. If the node could not be reached, it should have a distance of `Infinity`.
+La tua funzione produrrà coppie chiave-valore di un oggetto JavaScript con il nodo e la sua distanza dalla radice. Se il nodo non può essere raggiunto, dovrebbe avere una distanza di `Infinity`.
# --hints--
-The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `1` should return `{0: 1, 1: 0, 2: 1, 3: 2}`
+Il grafico in ingresso `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` con un nodo iniziale di `1` dovrebbe restituire `{0: 1, 1: 0, 2: 1, 3: 2}`
```js
assert(
@@ -49,7 +49,7 @@ assert(
);
```
-The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` with a start node of `1` should return `{0: 1, 1: 0, 2: 1, 3: Infinity}`
+Il grafico in ingresso `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` con un nodo iniziale di `1` dovrebbe restituire `{0: 1, 1: 0, 2: 1, 3: Infinity}`
```js
assert(
@@ -66,7 +66,7 @@ assert(
);
```
-The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `0` should return `{0: 0, 1: 1, 2: 2, 3: 3}`
+Il grafico in ingresso `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` con un nodo iniziale di `0` dovrebbe restituire `{0: 0, 1: 1, 2: 2, 3: 3}`
```js
assert(
@@ -83,7 +83,7 @@ assert(
);
```
-The input graph `[[0, 1], [1, 0]]` with a start node of `0` should return `{0: 0, 1: 1}`
+Il grafo in ingresso `[[0, 1], [1, 0]]` con un nodo iniziale di `0` dovrebbe restituire `{0: 0, 1: 1}`
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-circular-queue.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-circular-queue.md
index 16ff688fab..70828ff286 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-circular-queue.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-circular-queue.md
@@ -1,6 +1,6 @@
---
id: 587d8255367417b2b2512c75
-title: Create a Circular Queue
+title: Creare una coda circolare
challengeType: 1
forumTopicId: 301625
dashedName: create-a-circular-queue
@@ -8,9 +8,9 @@ dashedName: create-a-circular-queue
# --description--
-In this challenge you will be creating a Circular Queue. A circular queue is a queue that writes to the end of a collection then begins overwriting itself at the beginning of the collection. This type of data structure is useful in certain situations. For example, a circular queue can be used for streaming media. Once the queue is full, new media data will overwrite old data.
+In questa sfida creerai una coda circolare. Una coda circolare è una coda che scrive alla fine di una collezione, poi inizia a sovrascrivere sè stessa all'inizio della collezione. Questo tipo di struttura dati è utile in determinate situazioni. Ad esempio, una coda circolare può essere utilizzata per lo streaming media. Una volta che la coda è piena, i nuovi dati multimediali sovrascriveranno i vecchi dati.
-A good way to illustrate this concept is with an array of length `5`:
+Un buon modo per illustrare questo concetto è con un array di lunghezza `5`:
```js
[null, null, null, null, null]
@@ -18,7 +18,7 @@ A good way to illustrate this concept is with an array of length `5`:
^Write @ 0
```
-Here the read and write are both at position `0`. Now the queue gets 3 new records `a`, `b`, and `c`. Our queue now looks like:
+Qui la lettura e la scrittura sono entrambe in posizione `0`. Ora la coda ottiene 3 nuovi record `a`, `b`e `c`. La nostra coda ora assomiglia a:
```js
[a, b, c, null, null]
@@ -26,7 +26,7 @@ Here the read and write are both at position `0`. Now the queue gets 3 new recor
^Write @ 3
```
-As the read head reads, it can remove values or keep them:
+Come la testa di lettura legge, può remove valori o conservarli:
```js
[null, null, null, null, null]
@@ -34,7 +34,7 @@ As the read head reads, it can remove values or keep them:
^Write @ 3
```
-Now we write the values `d`, `e`, and `f` to the queue. Once the write reaches the end of the array it loops back to the beginning:
+Ora scriviamo i valori `d`, `e` e `f` nella coda. Una volta che la scrittura raggiunge la fine dell'array si riprende dall'inizio:
```js
[f, null, null, d, e]
@@ -42,21 +42,21 @@ Now we write the values `d`, `e`, and `f` to the queue. Once the write reaches t
^Write @ 1
```
-This approach requires a constant amount of memory but allows files of a much larger size to be processed.
+Questo approccio richiede una quantità costante di memoria, ma consente di elaborare file di dimensioni molto più grandi.
# --instructions--
-In this challenge we will implement a circular queue. The circular queue should provide `enqueue` and `dequeue` methods which allow you to read from and write to the queue. The class itself should also accept an integer argument which you can use to specify the size of the queue when created. We've written the starting version of this class for you in the code editor.
+In questa sfida implementeremo una coda circolare. La coda circolare dovrebbe fornire i metodi `enqueue` e `dequeue` che ti consentono di leggere e scrivere nella coda. La classe stessa dovrebbe anche accettare un argomento intero che puoi usare per specificare la dimensione della coda quando viene creata. Abbiamo scritto per te la versione iniziale di questa classe nell'editor di codice.
-When you enqueue items to the queue, the write pointer should advance forward and loop back to the beginning once it reaches the end of the queue. The `enqueue` method should return the item you enqueued if it is successful; otherwise it will return `null`.
+Quando accodi gli elementi alla coda, il puntatore di scrittura dovrebbe andare in avanti e tornare all'inizio una volta che ha raggiunto la fine della coda. Il metodo `enqueue` dovrebbe restituire l'elemento che hai accodato se ha avuto successo; altrimenti restituirà `null`.
-Likewise, the read pointer should advance forward as you dequeue items. When you dequeue an item, that item should be returned. If you cannot dequeue an item, you should return `null`.
+Allo stesso modo, il puntatore di lettura dovrebbe avanzare come rimuovi oggetti dalla coda. Quando rimuovi un oggetto dalla coda, quell'oggetto dovrebbe essere restituito. Se non puoi rimuovere un oggetto dalla coda, dovresti restituire `null`.
-The write pointer should not be allowed to move past the read pointer (our class won't let you overwrite data you haven't read yet) and the read pointer should not be able to advance past data you have written.
+Al puntatore di scrittura non dovrebbe essere permesso di muovere oltre il puntatore di lettura (la nostra classe non ti permetterà di sovrascrivere dati che non sono ancora stati letti) e il puntatore di lettura non dovrebbe eessere in grado di andare oltre i dati che hai scritto.
# --hints--
-The `enqueue` method should add items to the circular queue.
+Il metodo `enqueue` dovrebbe aggiungere elementi alla coda circolare.
```js
assert(
@@ -71,7 +71,7 @@ assert(
);
```
-You should not enqueue items past the read pointer.
+Non dovresti accodare gli elementi oltre il puntatore di lettura.
```js
assert(
@@ -89,7 +89,7 @@ assert(
);
```
-The `dequeue` method should dequeue items from the queue.
+Il metodo `dequeue` dovrebbe rimuovere elementi dalla coda.
```js
assert(
@@ -105,7 +105,7 @@ assert(
);
```
-After an item is dequeued, its position in the queue should be reset to `null`.
+Dopo che un elemento è stato rimosso dalla coda, la sua posizione nella coda dovrebbe essere resettata su `null`.
```js
assert(
@@ -122,7 +122,7 @@ assert(
);
```
-Trying to dequeue past the write pointer should return `null` and does not advance the write pointer.
+Tentare di rimuovere oggetti dalla coda oltre il puntatore di scrittura dovrebbe restituire `null` e non far avanzare il puntatore di scrittura.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md
index a33c3d5178..fdbabbfa61 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-hash-table.md
@@ -1,6 +1,6 @@
---
id: 587d825b367417b2b2512c8e
-title: Create a Hash Table
+title: Creare una tabella hash
challengeType: 1
forumTopicId: 301627
dashedName: create-a-hash-table
@@ -8,23 +8,23 @@ dashedName: create-a-hash-table
# --description--
-In this challenge we will learn about hash tables. A Hash table is used to implement associative arrays, or mappings of key-value pairs, like the objects and Maps we have just been studying. A JavaScript object could be implemented as a hash table, for instance (its actual implementation will depend on the environment it's running in). The way a hash table works is that it takes a key input and hashes this key in a deterministic way to some numerical value. This numerical value is then used as the actual key the associated value is stored by. Then, if you try to access the same key again, the hashing function will process the key, return the same numerical result, which will then be used to look up the associated value. This provides very efficient O(1) lookup time on average.
+In questa sfida conosceremo le tabelle hash. Una tabella hash viene utilizzata per implementare array associativi, o mappature di coppie chiave-valore, come gli oggetti e le mappe che abbiamo appena studiato. Un oggetto JavaScript ad esempio potrebbe essere implementato come una tabella hash (la sua effettiva implementazione dipenderà dall'ambiente in esecuzione). Il modo in cui funziona una tabella di hash è che richiede un input chiave e fa hash di questa chiave in modo deterministico ad un certo valore numerico. Questo valore numerico viene quindi utilizzato come chiave reale con cui viene memorizzato il valore associato. Quindi, se si tenta di accedere di nuovo alla stessa chiave, la funzione di hash elaborerà la chiave, restituirà lo stesso risultato numerico, che verrà poi utilizzato per cercare il valore associato. Questo fornisce un tempo di ricerca O(1) molto efficiente in media.
-Hash tables can be implemented as arrays with hash functions producing array indices within a specified range. In this method, the choice of the array size is important, as is the hashing function. For instance, what if the hashing function produces the same value for two different keys? This is called a collision. One way to handle collisions is to just store both key-value pairs at that index. Then, upon lookup of either, you would have to iterate through the bucket of items to find the key you are looking for. A good hashing function will minimize collisions to maintain efficient search time.
+Le tabelle di hash possono essere implementate come array con funzioni di hash che producono indici array all'interno di un intervallo specificato. In questo metodo, la scelta della dimensione dell'array è importante, così come la funzione di hashing. Per esempio, cosa succede se la funzione di hashing produce lo stesso valore per due chiavi diverse? Questa si chiama collisione. Un modo per gestire le collisioni è quello di semplicemente memorizzare entrambe le coppie chiave-valore in quell'indice. Poi, alla ricerca di entrambi, si dovrebbe iterare attraverso il gruppo di oggetti per trovare la chiave che stai cercando. Una buona funzione di hashing minimizzerà le collisioni per mantenere il tempo di ricerca efficiente.
-Here, we won't be concerned with the details of hashing or hash table implementation, we will just try to get a general sense of how they work.
+Risultati della traduzione Qui non ci occuperemo dei dettagli dell'hashing o dell'implementazione della tabella hash, cercheremo solo di avere un'idea generale di come funzionano.
# --instructions--
-Let's create the basic functionality of a hash table. We've created a naive hashing function for you to use. You can pass a string value to the function `hash` and it will return a hashed value you can use as a key for storage. Store items based on this hashed value in the `this.collection` object. Create these three methods: `add`, `remove`, and `lookup`. The first should accept a key value pair to add to the hash table. The second should remove a key-value pair when passed a key. The third should accept a key and return the associated value or `null` if the key is not present.
+Creiamo la funzionalità di base di una tabella di hash. Abbiamo creato una funzione di hashing ingenua da usare. Puoi passare un valore di stringa alla funzione `hash` e restituirà un valore hashed che puoi usare come chiave per l'archiviazione. Memorizza gli oggetti in base a questo valore hashed nell'oggetto `this.collection`. Crea questi tre metodi: `add`, `remove` e `lookup`. Il primo dovrebbe accettare una coppia di valori chiave da aggiungere alla tabella hash. Il secondo dovrebbe rimuovere una coppia chiave-valore quando riceve una chiave. Il terzo dovrebbe accettare una chiave e restituire il valore associato o `null` se la chiave non è presente.
-Be sure to write your code to account for collisions!
+Assicurati di scrivere il tuo codice per gestire le collisioni!
-**Note:** The `remove` method tests won't pass until the `add` and `lookup` methods are correctly implemented.
+**Nota:** I test del metodo `remove` non passeranno fino a quando i metodi `add` e `lookup` non saranno correttamente implementati.
# --hints--
-The HashTable data structure should exist.
+La struttura di dati HashTable dovrebbe esistere.
```js
assert(
@@ -38,7 +38,7 @@ assert(
);
```
-The HashTable should have an add method.
+L'HashTable dovrebbe avere un metodo add.
```js
assert(
@@ -52,7 +52,7 @@ assert(
);
```
-The HashTable should have a lookup method.
+L'HashTable dovrebbe avere un metodo lookup.
```js
assert(
@@ -66,7 +66,7 @@ assert(
);
```
-The HashTable should have a remove method.
+L'HashTable dovrebbe avere un metodo remove.
```js
assert(
@@ -80,7 +80,7 @@ assert(
);
```
-The add method should add key value pairs and the lookup method should return the values associated with a given key.
+Il metodo add dovrebbe aggiungere coppie chiave-valore e il metodo di ricerca dovrebbe restituire i valori associati a una determinata chiave.
```js
assert(
@@ -95,7 +95,7 @@ assert(
);
```
-The remove method should accept a key as input and should remove the associated key value pair.
+Il metodo di rimozione dovrebbe accettare una chiave come input e dovrebbe rimuovere la coppia chiave-valore associata.
```js
assert(
@@ -113,7 +113,7 @@ assert(
);
```
-The remove method should only remove the correct key value pair.
+Il metodo di rimozione dovrebbe rimuovere solo la coppia chiave-valore corretta.
```js
assert(
@@ -139,7 +139,7 @@ assert(
);
```
-Items should be added using the hash function.
+Gli elementi devono essere aggiunti usando la funzione hash.
```js
assert(
@@ -157,7 +157,7 @@ assert(
);
```
-The hash table should handle collisions.
+La tabella di hash dovrebbe gestire le collisioni.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-queue-class.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-queue-class.md
index b167ebfcdf..6f60804427 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-queue-class.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-queue-class.md
@@ -1,6 +1,6 @@
---
id: 587d8250367417b2b2512c60
-title: Creare una classe Coda
+title: Creare una classe Queue
challengeType: 1
forumTopicId: 301631
dashedName: create-a-queue-class
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md
index fb838c883e..4afbd6a370 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-a-trie-search-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8259367417b2b2512c84
-title: Create a Trie Search Tree
+title: Crea un albero di ricerca Trie
challengeType: 1
forumTopicId: 301634
dashedName: create-a-trie-search-tree
@@ -8,15 +8,15 @@ dashedName: create-a-trie-search-tree
# --description--
-Here we will move on from binary search trees and take a look at another type of tree structure called a trie. A trie is an ordered search tree commonly used to hold strings, or more generically associative arrays or dynamic datasets in which the keys are strings. They are very good at storing sets of data when many keys will have overlapping prefixes, for example, all the words in a dictionary. Unlike a binary tree, nodes are not associated with actual values. Instead, the path to a node represents a specific key. For instance, if we wanted to store the string code in a trie, we would have four nodes, one for each letter: c — o — d — e. Following that path through all these nodes will then create code as a string — that path is the key we stored. Then, if we wanted to add the string coding, it would share the first three nodes of code before branching away after the d. In this way, large datasets can be stored very compactly. In addition, search can be very quick because it is effectively limited to the length of the string you are storing. Furthermore, unlike binary trees a node can store any number of child nodes. As you might have guessed from the above example, some metadata is commonly stored at nodes that hold the end of a key so that on later traversals that key can still be retrieved. For instance, if we added codes in our example above we would need some way to know that the e in code represents the end of a key that was previously entered. Otherwise, this information would effectively be lost when we add codes.
+Qui ci muoveremo dagli alberi di ricerca binari e daremo un'occhiata ad un altro tipo di struttura ad albero chiamato trie. Un trie è un albero di ricerca ordinato comunemente usato per contenere stringhe, o più generamente array associativi o dataset dinamici in cui le chiavi sono stringhe. Sono un ottimo modo per immagazzinare set di dati quando molte chiavi hanno prefissi che si sovrappongono, per esempio, tutte le parole in un dizionario. A differenza di un albero binario, i nodi non sono associati con valori. Invece, il percorso verso un nodo rappresenta una chiave specifica. Per esempio, se vogliamo salvare la stringa "code" in un trie, avremmo quattri nodi, uno per ogni lettera: c — o — d — e. Seguendo il percorso attraverso tutti questi nodi creerà la stringa "code" — quel percorso è la chiave che abbiamo immagazzinato. Quindi, se vogliamo aggiungere la stringa "coding", avrebbe in comune i primi tre nodi di "code" prima di seguire un altro ramo dopo la d. In questo modo, dataset ampi possono essere immagazzinati in maniera compatta. In aggiunta, una ricerca può essere molto veloce perché è effettivamente limitata alla lunghezza della stringa che stai immagazinnando. Inoltre, a differenza degli alberi binari un nodo può avere qualsiasi numero di nodi figli. Come potresti avere indovinato dall'esempio precedente, alcuni metadata sono comunemente salvati come nodi che contengono la fine della chiave cossicché in traversamenti succestivi la chiave può essere ancora recuperata. Per esempio, se avessimo aggiunto "codes" nell'esempio precedente, avremmo avuto bisogno di qualche modo per sapere che la e in "code" rappresenta la fine di una chiave che era stata inserita precedentemente. Altrimenti, questa informazione andrebbe persa quando aggiungiamo "codes".
# --instructions--
-Let's create a trie to store words. It will accept words through an `add` method and store these in a trie data structure. It will also allow us to query if a given string is a word with an `isWord` method, and retrieve all the words entered into the trie with a `print` method. `isWord` should return a boolean value and print should return an array of all these words as string values. In order for us to verify that this data structure is implemented correctly, we've provided a `Node` structure for each node in the tree. Each node will be an object with a `keys` property which is a JavaScript Map object. This will hold the individual letters that are valid keys of each node. We've also created an `end` property on the nodes that can be set to `true` if the node represents the termination of a word.
+Creiamo un trie per memorizzare parole. Accetterà parole attraverso un metodo `add` e salverà queste parole in una struttura dati trie. Permetterà anche di chiedere se una certa stringa è una parola con un metodo `isWord`, e estrarre tutte le parole inserite nel trie con un metodo `print`. `isWord` dovrebbe restituire un valore booleano e print dovrebbe restituire un array di tutte queste parole come stringhe. Per poter verificare che la struttura dati è implementata correttamente, abbiamo provveduto una struttura `Node` per ogni nodo dell'albero. Ogni nodo sarà un oggetto con una proprietà `keys` che è un oggetto Map JavaScript. Questo conterrà le lettere individuali che sono chiavi valide per ogni nodo. Abbiamo anche creato una proprietà `end` nel nodo che può essere messa su `true` se il nodo rappresenta la terminazione di una parola.
# --hints--
-The Trie should have an add method.
+Il Trie dovrebbe avere un metodo add.
```js
assert(
@@ -32,7 +32,7 @@ assert(
);
```
-The Trie should have a print method.
+Il Trie dovrebbe avere un metodo print.
```js
assert(
@@ -48,7 +48,7 @@ assert(
);
```
-The Trie should have an isWord method.
+Il Trie dovrebbe avere un metodo isWord.
```js
assert(
@@ -64,7 +64,7 @@ assert(
);
```
-The print method should return all items added to the trie as strings in an array.
+Il metodo print dovrebbe restituire tutti gli elementi aggiunti al trie come stringhe in un array.
```js
assert(
@@ -93,7 +93,7 @@ assert(
);
```
-The isWord method should return true only for words added to the trie and false for all other words.
+Il metodo isWord dovrebbe restituire vero solo per le parole aggiunte al trie e falso per tutte le altre parole.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-an-es6-javascript-map.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-an-es6-javascript-map.md
index 7e6822ef67..1a6ec608b3 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-an-es6-javascript-map.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-an-es6-javascript-map.md
@@ -1,6 +1,6 @@
---
id: 587d825b367417b2b2512c8d
-title: Create an ES6 JavaScript Map
+title: Creare una mappa JavaScript ES6
challengeType: 1
forumTopicId: 301635
dashedName: create-an-es6-javascript-map
@@ -8,21 +8,21 @@ dashedName: create-an-es6-javascript-map
# --description--
-The new version of JavaScript provides us with a built-in Map object which provides much of the functionality we wrote by hand in the last challenge. This Map object, although similar to regular JavaScript objects, provides some useful functionality that normal objects lack. For example, an ES6 Map tracks the insertion order of items that are added to it. Here is a more complete overview of its methods: `.has(key)` returns true or false based on the presence of a key `.get(key)` returns the value associated with a key `.set(key, value)` sets a new key, value pair `.delete(key)` removes a key, value pair `.clear()` removes all key, value pairs `.entries()` returns an array of all the keys in insertion order `.values()` returns an array of all the values in insertion order
+La nuova versione di JavaScript ci fornisce un oggetto Map incorporato che fornisce gran parte delle funzionalità che abbiamo scritto a mano nell'ultima sfida. Questo oggetto Map, anche se simile a oggetti JavaScript regolari, fornisce alcune funzionalità utili che agli oggetti normali mancano. Ad esempio, una Map ES6 tiene in memoria l'ordine di inserimento degli elementi che vengono aggiunti. Ecco una panoramica più completa dei suoi metodi: `.has(key)` restituisce true o false in base alla presenza di una chiave `.get(key)` restituisce il valore associato con una chiave `.set(key, value)` aggiunge una nuova coppia chiave-valore `.delete(key)` rimuove una coppia chiave-valore `.clear()` rimuove tutte le coppie chiave-valore `.entries()` restituisce un array con tutte le chiavi in ordine di inserimento `.values()` restituisce un array con tutti i valori in ordine di inserzione
# --instructions--
-Define a JavaScript Map object and assign to it a variable called myMap. Add the key, value pair `freeCodeCamp`, `Awesome!` to it.
+Definisci un oggetto Map JavaScript e assegna ad esso una variabile chiamata myMap. Aggiungi la coppia chiave-valore `freeCodeCamp`, `Awesome!` ad esso.
# --hints--
-The myMap object should exist.
+L'oggetto myMap dovrebbe esistere.
```js
assert(typeof myMap === 'object');
```
-myMap should contain the key value pair `freeCodeCamp`, `Awesome!`.
+myMap dovrebbe contenere la coppia chiave-valore `freeCodeCamp`, `Awesome!`.
```js
assert(myMap.get('freeCodeCamp') === 'Awesome!');
@@ -39,5 +39,7 @@ assert(myMap.get('freeCodeCamp') === 'Awesome!');
# --solutions--
```js
-// solution required
+const myMap = new Map();
+
+myMap.set("freeCodeCamp", "Awesome!");
```
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-and-add-to-sets-in-es6.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-and-add-to-sets-in-es6.md
index 1727a24ed0..04ff67a6d8 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-and-add-to-sets-in-es6.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/create-and-add-to-sets-in-es6.md
@@ -1,6 +1,6 @@
---
id: 587d8254367417b2b2512c70
-title: Create and Add to Sets in ES6
+title: Creare e aggiungere ai set in ES6
challengeType: 1
forumTopicId: 301636
dashedName: create-and-add-to-sets-in-es6
@@ -8,34 +8,34 @@ dashedName: create-and-add-to-sets-in-es6
# --description--
-Now that you have worked through ES5, you are going to perform something similar in ES6. This will be considerably easier. ES6 contains a built-in data structure `Set` so many of the operations you wrote by hand are now included for you. Let's take a look:
+Ora che avete lavorato su ES5, state per eseguire qualcosa di simile in ES6. Questo sarà molto più facile. ES6 contiene una struttura di dati integrata `Set` quindi molte delle operazioni che hai scritto a mano sono ora incluse per te. Diamo un'occhiata:
-To create a new empty set:
+Per creare un nuovo set vuoto:
```js
var set = new Set();
```
-You can create a set with a value:
+È possibile creare un set con un valore:
```js
var set = new Set(1);
```
-You can create a set with an array:
+È possibile creare un set con un array:
```js
var set = new Set([1, 2, 3]);
```
-Once you have created a set, you can add the values you wish using the `add` method:
+Una volta creato un set, puoi aggiungere i valori che desideri utilizzando il metodo `add`:
```js
var set = new Set([1, 2, 3]);
set.add([4, 5, 6]);
```
-As a reminder, a set is a data structure that cannot contain duplicate values:
+Come promemoria, un insieme è una struttura di dati che non può contenere valori duplicati:
```js
var set = new Set([1, 2, 3, 1, 2, 3]);
@@ -44,11 +44,11 @@ var set = new Set([1, 2, 3, 1, 2, 3]);
# --instructions--
-For this exercise, return a set with the following values: `1, 2, 3, 'Taco', 'Cat', 'Awesome'`
+Per questo esercizio, restituisci un set con i seguenti valori: `1, 2, 3, 'Taco', 'Cat', 'Awesome'`
# --hints--
-Your `Set` should only contain the values `1, 2, 3, Taco, Cat, Awesome`.
+Il tuo `Set` deve contenere solo i valori `1, 2, 3, Taco, Cat, Awesome`.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
index 7aa19f4c83..1a422ae4b2 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
@@ -46,6 +46,25 @@ assert(
);
```
+Tentare di rimuovere un elemento da un albero vuoto dovrebbe restituire `null`.
+
+```js
+assert(
+ (function () {
+ var test = false;
+ if (typeof BinarySearchTree !== 'undefined') {
+ test = new BinarySearchTree();
+ } else {
+ return false;
+ }
+ if (typeof test.remove !== 'function') {
+ return false;
+ }
+ return test.remove(100) == null;
+ })()
+);
+```
+
Tentare di rimuovere un elemento che non esiste dovrebbe restituire `null`.
```js
@@ -60,6 +79,8 @@ assert(
if (typeof test.remove !== 'function') {
return false;
}
+ test.add(15);
+ test.add(30);
return test.remove(100) == null;
})()
);
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md
index eb71f5ea47..8e7556d350 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-height-of-a-binary-search-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8257367417b2b2512c7d
-title: Find the Minimum and Maximum Height of a Binary Search Tree
+title: Trovare l'altezza minima e massima di un albero binario di ricerca
challengeType: 1
forumTopicId: 301641
dashedName: find-the-minimum-and-maximum-height-of-a-binary-search-tree
@@ -8,19 +8,19 @@ dashedName: find-the-minimum-and-maximum-height-of-a-binary-search-tree
# --description--
-In the last challenge we described a scenario in which a tree could become unbalanced. To understand the concept of balance, let's take a look at another tree property: height. Height in a tree represents the distance from the root node to any given leaf node. Different paths in a highly branched tree structure may have different heights, but for a given tree there will be a minimum and maximum height. If the tree is balanced, these values will differ at most by one. This means that in a balanced tree, all the leaf nodes exist within the same level, or if they are not within the same level they are at most one level apart.
+Nell'ultima sfida abbiamo descritto uno scenario in cui un albero potrebbe diventare squilibrato. Per capire il concetto di equilibrio, diamo un'occhiata ad un'altra proprietà dell'albero: l'altezza. L'altezza in un albero rappresenta la distanza dal nodo radice a qualsiasi nodo foglia. Percorsi diversi in una struttura ad albero altamente ramificato possono avere altezze diverse, ma per un dato albero ci sarà un'altezza minima e una massima. Se l'albero è bilanciato, questi valori differiranno al massimo di uno. Ciò significa che in un albero bilanciato, tutti i nodi delle foglie sono allo stesso livello, o al massimo a un livello di distanza.
-The property of balance is important for trees because it is what determines the efficiency of tree operations. As we explained in the last challenge, we face worst case time complexity for heavily unbalanced trees. Self-balancing trees are commonly used to account for this issue in trees with dynamic data sets. Common examples of these include AVL trees, red-black trees, and B-trees. These trees all contain additional internal logic which re-balance the tree when insertions or deletions create a state of imbalance.
+La proprietà dell'equilibrio è importante per gli alberi perché è ciò che determina l'efficienza delle operazioni su di essi. Come abbiamo spiegato nell'ultima sfida, per alberi fortemente squilibrati ci troviamo di fronte alla peggiore complessità temporale. Gli alberi auto-bilancianti sono comunemente utilizzati per tenere conto di questo problema in alberi con serie di dati dinamici. Esempi comuni di questi includono gli alberi AVL, gli alberi rosso-neri e gli alberi B. Tutti questi alberi contengono una logica interna aggiuntiva che riequilibra l'albero quando inserzioni o cancellazioni creano uno stato di squilibrio.
-**Note:** A similar property to height is depth, which refers to how far a given node is from the root node.
+**Nota:** Una proprietà simile all'altezza è la profondità, che si riferisce a quanto un dato nodo è lontano dal nodo radice.
# --instructions--
-Write two methods for our binary tree: `findMinHeight` and `findMaxHeight`. These methods should return an integer value for the minimum and maximum height within a given binary tree, respectively. If the node is empty let's assign it a height of `-1` (that's the base case). Finally, add a third method `isBalanced` which returns `true` or `false` depending on whether the tree is balanced or not. You can use the first two methods you just wrote to determine this.
+Scrivi due metodi per il nostro albero binario: `findMinHeight` e `findMaxHeight`. Questi metodi dovrebbero restituire un valore intero per l'altezza minima e massima all'interno di un dato albero binario, rispettivamente. Se il nodo è vuoto, assegniamogli un'altezza di `-1` (questo è il caso di base). Infine, aggiungi un terzo metodo `isBalanced` che restituisce `true` o `false` a seconda che l'albero sia bilanciato o meno. È possibile utilizzare i primi due metodi che hai appena scritto per determinarlo.
# --hints--
-The `BinarySearchTree` data structure should exist.
+La struttura di dati `BinarySearchTree` dovrebbe esistere.
```js
assert(
@@ -34,7 +34,7 @@ assert(
);
```
-The binary search tree should have a method called `findMinHeight`.
+L'albero binario di ricerca dovrebbe avere un metodo chiamato `findMinHeight`.
```js
assert(
@@ -50,7 +50,7 @@ assert(
);
```
-The binary search tree should have a method called `findMaxHeight`.
+L'albero binario di ricerca dovrebbe avere un metodo chiamato `findMaxHeight`.
```js
assert(
@@ -66,7 +66,7 @@ assert(
);
```
-The binary search tree should have a method called `isBalanced`.
+L'albero binario di ricerca dovrebbe avere un metodo chiamato `isBalanced`.
```js
assert(
@@ -82,7 +82,7 @@ assert(
);
```
-The `findMinHeight` method should return the minimum height of the tree.
+Il metodo `findMinHeight` deve restituire l'altezza minima dell'albero.
```js
assert(
@@ -109,7 +109,7 @@ assert(
);
```
-The `findMaxHeight` method should return the maximum height of the tree.
+Il metodo `findMaxHeight` deve restituire l'altezza massima dell'albero.
```js
assert(
@@ -136,7 +136,7 @@ assert(
);
```
-An empty tree should return a height of `-1`.
+Un albero vuoto dovrebbe restituire un'altezza di `-1`.
```js
assert(
@@ -155,7 +155,7 @@ assert(
);
```
-The `isBalanced` method should return `false` if the tree is an unbalanced binary search tree.
+Il metodo `isBalanced` dovrebbe restituire `false` se l'albero è un albero binario di ricerca sbilanciato.
```js
assert(
@@ -182,7 +182,7 @@ assert(
);
```
-The `isBalanced` method should return `true` if the tree is a balanced binary search tree.
+Il metodo `isBalanced` dovrebbe restituire `true` se l'albero è un albero binario di ricerca equilibrato.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md
index 23077f9d93..127b719edc 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/find-the-minimum-and-maximum-value-in-a-binary-search-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8256367417b2b2512c7a
-title: Find the Minimum and Maximum Value in a Binary Search Tree
+title: Trovare i valori minimo e massimo di un albero binario di ricerca
challengeType: 1
forumTopicId: 301642
dashedName: find-the-minimum-and-maximum-value-in-a-binary-search-tree
@@ -8,11 +8,11 @@ dashedName: find-the-minimum-and-maximum-value-in-a-binary-search-tree
# --description--
-In this challenge you will define two methods, `findMin` and `findMax`. These methods should return the minimum and maximum value held in the binary search tree (don't worry about adding values to the tree for now, we have added some in the background). If you get stuck, reflect on the invariant that must be true for binary search trees: each left subtree is less than or equal to its parent and each right subtree is greater than or equal to its parent. Let's also say that our tree can only store integer values. If the tree is empty, either method should return `null`.
+In questa sfida definirai due metodi, `findMin` e `findMax`. Questi metodi dovrebbero restituire il valore minimo e massimo contenuto nell'albero binario di ricerca (non preoccuparti di aggiungere valori all'albero per ora, ne abbiamo aggiunti alcuni in background). Se si rimani bloccato, rifletti sull'invariante che deve essere vera per gli alberi di ricerca binari: ogni sottoalbero sinistro è inferiore o uguale al suo genitore e ogni sottoalbero destro è maggiore o uguale al suo genitore. Diciamo anche che il nostro albero può memorizzare solo valori interi. Se l'albero è vuoto, uno dei due metodi dovrebbe restituire `null`.
# --hints--
-The `BinarySearchTree` data structure should exist.
+La struttura di dati `BinarySearchTree` dovrebbe esistere.
```js
assert(
@@ -26,7 +26,7 @@ assert(
);
```
-The binary search tree should have a method called `findMin`.
+L'albero binario di ricerca dovrebbe avere un metodo chiamato `findMin`.
```js
assert(
@@ -42,7 +42,7 @@ assert(
);
```
-The binary search tree should have a method called `findMax`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `findMax`.
```js
assert(
@@ -58,7 +58,7 @@ assert(
);
```
-The `findMin` method should return the minimum value in the binary search tree.
+Il metodo `findMin` dovrebbe restituire il valore minimo nell'albero binario di ricerca.
```js
assert(
@@ -85,7 +85,7 @@ assert(
);
```
-The `findMax` method should return the maximum value in the binary search tree.
+Il metodo `findMax` dovrebbe restituire il valore massimo nell'albero binario di ricerca.
```js
assert(
@@ -112,7 +112,7 @@ assert(
);
```
-The `findMin` and `findMax` methods should return `null` for an empty tree.
+I metodi `findMin` e `findMax` dovrebbero restituire `null` per un albero vuoto.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md
index 158817a64d..317d7da3ec 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/implement-heap-sort-with-a-min-heap.md
@@ -1,6 +1,6 @@
---
id: 587d825b367417b2b2512c8c
-title: Implement Heap Sort with a Min Heap
+title: Implementa un Heap Sort con un Min Heap
challengeType: 1
forumTopicId: 301643
dashedName: implement-heap-sort-with-a-min-heap
@@ -8,17 +8,17 @@ dashedName: implement-heap-sort-with-a-min-heap
# --description--
-Now that we can add and remove elements let's see some of the applications heaps can be used for. Heaps are commonly used to implement priority queues because they always store an item of greatest or least value in first position. In addition, they are used to implement a sorting algorithm called heap sort. We'll see how to do this here. Heap sort uses a min heap, the reverse of a max heap. A min heap always stores the element of least value in the root position.
+Ora che possiamo aggiungere e rimuovere elementi vediamo alcune applicazioni per cui gli heap possono essere usati. Gli heap sono comunemente usati per implementare file di priorità perché immagazzinano sempre un elemento di valore massimo o minimo nella prima posizione. In aggiunta, sono usati per implementare un algoritmo di ordinamento chiamato heap sort. Vedremo come farlo qui. Heap sort usa un min heap, l'opposto di un max heap. Un min heap ha sempre l'elemento di valore minore nella posizione root.
-Heap sort works by taking an unsorted array, adding each item in the array into a min heap, and then extracting every item out of the min heap into a new array. The min heap structure ensures that the new array will contain the original items in least to greatest order. This is one of the most efficient sorting algorithms with average and worst case performance of O(nlog(n)).
+Heap sort funziona prendendo un array non ordinato, aggiungendo ogni elemento dell'array in un min heap, e poi estraendo ogni elemento dal min heap in un array. La struttura min heap assicura che il nuovo array conterra gli elementi originali in ordine dal più piccolo al più grande. Questo è uno degli algoritmi per ordinare più efficienti con una performance media e nel peggiore dei casi di O(nlog(n)).
# --instructions--
-Let's implement heap sort with a min heap. Feel free to adapt your max heap code here. Create an object `MinHeap` with `insert`, `remove`, and `sort` methods. The `sort` method should return an array of all the elements in the min heap sorted from smallest to largest.
+Implementa un heap sort con un min heap. Adatta liberamente il codice del tuo max heap qui. Crea un oggetto `MinHeap` con metodi `insert`, `remove`, e `sort`. Il metodo `sort` dovrebbe restituire un array degli elementi nel min heap ordinati dal più piccolo al più grande.
# --hints--
-The MinHeap data structure should exist.
+La struttura dati MinHeap dovrebbe esistere.
```js
assert(
@@ -32,7 +32,7 @@ assert(
);
```
-MinHeap should have a method called insert.
+MinHeap dovrebbe avere un metodo chiamato insert.
```js
assert(
@@ -48,7 +48,7 @@ assert(
);
```
-MinHeap should have a method called remove.
+MinHeap dovrebbe avere un metodo chiamato remove.
```js
assert(
@@ -64,7 +64,7 @@ assert(
);
```
-MinHeap should have a method called sort.
+MinHeap dovrebbe avere un metodo chiamato sort.
```js
assert(
@@ -80,7 +80,7 @@ assert(
);
```
-The sort method should return an array containing all items added to the min heap in sorted order.
+Il metodo sort dovrebbe restituire un array che continuete tutto gli elementi aggiunti al min heap ordinati.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md
index e20657a87c..ff09080e2a 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/insert-an-element-into-a-max-heap.md
@@ -1,6 +1,6 @@
---
id: 587d825a367417b2b2512c8a
-title: Insert an Element into a Max Heap
+title: Inserisci un elemento in un max heap
challengeType: 1
forumTopicId: 301703
dashedName: insert-an-element-into-a-max-heap
@@ -8,47 +8,47 @@ dashedName: insert-an-element-into-a-max-heap
# --description--
-Now we will move on to another tree data structure, the binary heap. A binary heap is a partially ordered binary tree which satisfies the heap property. The heap property specifies a relationship between parent and child nodes. You may have a max heap, in which all parent nodes are greater than or equal to their child nodes, or a min heap, in which the reverse is true. Binary heaps are also complete binary trees. This means that all levels of the tree are fully filled and if the last level is partially filled it is filled from left to right.
+Ora passeremo ad un'altra struttura di dati ad albero, l'heap binario. Un heap binario è un albero binario parzialmente ordinato che soddisfa la proprietà heap. La proprietà heap specifica una relazione tra nodi genitore e figlio. Potresti avere un max heap, in cui tutti i nodi genitori sono maggiori o uguali ai loro nodi figli, o un min heap, in cui il contrario è vero. Gli heap binari sono anche alberi binari completi. Questo significa che tutti i livelli dell'ablero sono completamente pieni e se l'ultimo livello è completo solo parzialmente è riempido da sinistra a destra.
-While binary heaps may be implemented as tree structures with nodes that contain left and right references, the partial ordering according to the heap property allows us to represent the heap with an array. The parent-children relationship is what we're interested in and with simple arithmetic we can compute the children of any parent and the parent of any child node.
+Anche se gli heap binari possono essere implementati come strutture ad albero con nodi che contengono riferimenti di sinistra e destra, l'ordine parziale in base alla proprietà heap ci permette di rappresentare l'heap con un array. Il rapporto genitore-figlio è quello a cui siamo interessati e con semplice aritmetica possiamo calcolare i figli di qualsiasi genitore e genitore di qualsiasi nodo figlio.
-For instance, consider this array representation of a binary min heap:
+Per esempio, considera questa rappresentazione array di un min heap binario:
```js
[ 6, 22, 30, 37, 63, 48, 42, 76 ]
```
-The root node is the first element, `6`. Its children are `22` and `30`. If we look at the relationship between the array indices of these values, for index `i` the children are `2 * i + 1` and `2 * i + 2`. Similarly, the element at index `0` is the parent of these two children at indices `1` and `2`. More generally, we can find the parent of a node at any index with the following: `Math.floor((i - 1) / 2)`. These patterns will hold true as the binary tree grows to any size. Finally, we can make a slight adjustment to make this arithmetic even easier by skipping the first element in the array. Doing this creates the following relationship for any element at a given index `i`:
+Il nodo radice è il primo elemento, `6`. I suoi figli sono `22` e `30`. Se consideriamo il rapporto tra gli indici di questi valori, per indice `i` i figli sono `2 * i + 1` e `2 * i + 2`. Analogamente, l'elemento all'indice `0` è il genitore di questi due figli agli indici `1` e `2`. Più in generale, possiamo trovare il genitore di un nodo in qualsiasi indice con il seguente: `Math.floor((i - 1) / 2)`. Questi pattern resteranno veri come l'albero cresce ad ogni dimensione. Infine, possiamo fare alcuni piccoli aggiustamenti per fare questa aritmetica ancora più semplice saltando il primo elemento dell'array. Facendo ciò si crea la seguente relazione per ogni elemento ad un dato indice `i`:
-Example array representation:
+Esempio di rappresentazione come array:
```js
[ null, 6, 22, 30, 37, 63, 48, 42, 76 ]
```
-An element's left child: `i * 2`
+Il figlio sinistro di un elemento: `i * 2`
-An element's right child: `i * 2 + 1`
+Il figlio destro di un elemento: `i * 2 + 1`
-An element's parent: `Math.floor(i / 2)`
+Il genitore di un elemento: `Math.floor(i / 2)`
-Once you wrap your head around the math, using an array representation is very useful because node locations can be quickly determined with this arithmetic and memory usage is diminished because you don't need to maintain references to child nodes.
+Una volta che prendi familiarità con la matematica, usare una rappresentazione ad array è molto utile perché la posizione dei nodi può essere determinata con questa artimetica e l'uso della memoria è diminuito perché non devi mantenere i riferimenti ai nodi figli.
# --instructions--
-Instructions: Here we will create a max heap. Start by just creating an `insert` method which adds elements to our heap. During insertion, it is important to always maintain the heap property. For a max heap this means the root element should always have the greatest value in the tree and all parent nodes should be greater than their children. For an array implementation of a heap, this is typically accomplished in three steps:
+Istruzioni: qui creeremo un max heap. Inizia creando semplicemente un metodo `insert` che aggiunge elementi al nostro heap. Durante l'inserzione, è importante mantenere sempre la proprietà heap. Per un max heap questo significa che l'elemento root deve sempre avere il valore maggiore nell'albero e tutti i nodi genitori devono essere più grandi dei loro figli. Per una rappresentazione ad array di un heap questo è tipicamente fatto in tre step:
- - Add the new element to the end of the array.
- - If the element is larger than its parent, switch them.
- - Continue switching until the new element is either smaller than its parent or you reach the root of the tree.
+ - Aggiungi il nuovo elemento alla fine dell'array.
+ - Se l'elemento è maggiore del suo genitore, scambiali.
+ - Continua a scambiare finché il nuovo elemento è più piccolo del genitore o raggiungi l'elemento root.
-Finally, add a `print` method which returns an array of all the items that have been added to the heap.
+Alla fine, aggiungi un metodo `print` che restituire un array di tutti gli elementi che sono stati aggiunti al heap.
# --hints--
-The MaxHeap data structure should exist.
+La struttura dati MaxHeap dovrebbe esistere.
```js
assert(
@@ -62,7 +62,7 @@ assert(
);
```
-MaxHeap should have a method called insert.
+MaxHeap dovrebbe avere un metodo chiamato insert.
```js
assert(
@@ -78,7 +78,7 @@ assert(
);
```
-MaxHeap should have a method called print.
+MaxHeap dovrebbe avere un metodo chiamato print.
```js
assert(
@@ -94,7 +94,7 @@ assert(
);
```
-The insert method should add elements according to the max heap property.
+Il metodo insert dovrebbe aggiungere elementi rispettando la proprietà max heap.
```js
assert(
@@ -133,20 +133,28 @@ var MaxHeap = function() {
```js
var MaxHeap = function() {
// Only change code below this line
- this.heap = [null];
- this.insert = (ele) => {
- var index = this.heap.length;
- var arr = [...this.heap];
- arr.push(ele);
- while (ele > arr[Math.floor(index / 2)] && index > 1) {
- arr[index] = arr[Math.floor(index / 2)];
- arr[Math.floor(index / 2)] = ele;
- index = arr[Math.floor(index / 2)];
- }
- this.heap = arr;
+ this.heap = [];
+ this.parent = index => {
+ return Math.floor((index - 1) / 2);
+ }
+ this.insert = element => {
+ this.heap.push(element);
+ this.heapifyUp(this.heap.length - 1);
+ }
+ this.heapifyUp = index => {
+ let currentIndex = index,
+ parentIndex = this.parent(currentIndex);
+ while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
+ this.swap(currentIndex, parentIndex);
+ currentIndex = parentIndex;
+ parentIndex = this.parent(parentIndex);
+ }
+ }
+ this.swap = (index1, index2) => {
+ [this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
}
this.print = () => {
- return this.heap.slice(1);
+ return this.heap;
}
// Only change code above this line
};
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md
index 8be38b0d5d..aa8f95560e 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/invert-a-binary-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8259367417b2b2512c83
-title: Invert a Binary Tree
+title: Invertire un albero binario
challengeType: 1
forumTopicId: 301704
dashedName: invert-a-binary-tree
@@ -8,11 +8,11 @@ dashedName: invert-a-binary-tree
# --description--
-Here will we create a function to invert a binary tree. Given a binary tree, we want to produce a new tree that is equivalently the mirror image of this tree. Running an inorder traversal on an inverted tree will explore the nodes in reverse order when compared to the inorder traversal of the original tree. Write a method to do this called `invert` on our binary tree. Calling this method should invert the current tree structure. Ideally, we would like to do this in-place in linear time. That is, we only visit each node once and we modify the existing tree structure as we go, without using any additional memory. Good luck!
+Qui creeremo una funzione per invertire un albero binario. Dato un albero binario, vogliamo produrre un nuovo albero che sia equivalente all'immagine speculare di questo albero. Eseguire un traversamento inorder su un albero invertito esplora i nodi in ordine inverso rispetto a un traversamento inorder sull'albero originale. Scrivi un metodo per farlo, chiamato `invert` sul nostro albero binario. Chiamare questo metodo dovrebbe invertire la struttura attuale dell'albero. Idealmente, vorremmo fare questo "in-place" (NdT: lavorando sull'array originale, senza crearne una copia) e in tempo lineare. Cioè, visitiamo ogni nodo solo una volta e modifichiamo la struttura di albero esistente mentre procediamo, senza usare memoria aggiuntiva. Buona fortuna!
# --hints--
-The `BinarySearchTree` data structure should exist.
+La struttura di dati `BinarySearchTree` dovrebbe esistere.
```js
assert(
@@ -26,7 +26,7 @@ assert(
);
```
-The binary search tree should have a method called `invert`.
+L'albero binario di ricerca dovrebbe avere un metodo chiamato `invert`.
```js
assert(
@@ -42,7 +42,7 @@ assert(
);
```
-The `invert` method should correctly invert the tree structure.
+Il metodo `invert` dovrebbe invertire correttamente la struttura dell'albero.
```js
assert(
@@ -70,7 +70,7 @@ assert(
);
```
-Inverting an empty tree should return `null`.
+Invertire un albero vuoto dovrebbe restituire `null`.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md
index 858073f211..cff5e8f7a8 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-an-element-from-a-max-heap.md
@@ -1,6 +1,6 @@
---
id: 587d825b367417b2b2512c8b
-title: Remove an Element from a Max Heap
+title: Rimuovere un elemento da una max-heap
challengeType: 1
forumTopicId: 301710
dashedName: remove-an-element-from-a-max-heap
@@ -8,21 +8,21 @@ dashedName: remove-an-element-from-a-max-heap
# --description--
-Now that we can add elements to our heap let's see how we can remove elements. Removing and inserting elements both require similar logic. In a max heap you will usually want to remove the greatest value, so this involves simply extracting it from the root of our tree. This will break the heap property of our tree, so we must reestablish it in some way. Typically, for a max heap this is done in the following way:
+Ora che possiamo aggiungere elementi al nostro heap vediamo come possiamo rimuovere gli elementi. La rimozione e l'inserimento di elementi richiedono una logica simile. In un max-heap di solito si vuole rimuovere il valore maggiore, quindi questo implica semplicemente estrarlo dalla radice del nostro albero. Questo negherà la proprietà heap del nostro albero, quindi dovremo ristabilirla in qualche modo. Tipicamente, per un max-heap questo viene fatto nel modo seguente:
- - Move the last element in the heap into the root position.
- - If either child of the root is greater than it, swap the root with the child of greater value.
- - Continue swapping until the parent is greater than both children or you reach the last level in the tree.
+ - Sposta l'ultimo elemento nell'heap alla posizione root.
+ - Se uno dei figli della radice è maggiore di essa, scambiare la radice con il figlio di valore maggiore.
+ - Continuare a scambiare fino a quando il genitore è maggiore di entrambi i figli o si raggiunge l'ultimo livello nell'albero.
# --instructions--
-Instructions: Add a method to our max heap called `remove`. This method should return the greatest value that has been added to our max heap and remove it from the heap. It should also reorder the heap so the heap property is maintained. After removing an element, the next greatest element remaining in the heap should become the root.
+Istruzioni: Aggiungere un metodo al nostro max-heap chiamato `remove`. Questo metodo dovrebbe restituire il massimo valore che è stato aggiunto al nostro max heap e rimuoverlo dal mucchio. Dovrebbe anche riordinare il mucchio in modo che la proprietà heap sia mantenuta. Dopo aver rimosso un elemento, il prossimo elemento più grande che rimane nel heap dovrebbe diventare la radice.
# --hints--
-The MaxHeap data structure should exist.
+La struttura dati MaxHeap dovrebbe esistere.
```js
assert(
@@ -36,7 +36,7 @@ assert(
);
```
-MaxHeap should have a method called print.
+MaxHeap dovrebbe avere un metodo chiamato print.
```js
assert(
@@ -52,7 +52,7 @@ assert(
);
```
-MaxHeap should have a method called insert.
+MaxHeap dovrebbe avere un metodo chiamato insert.
```js
assert(
@@ -68,7 +68,7 @@ assert(
);
```
-MaxHeap should have a method called remove.
+MaxHeap dovrebbe avere un metodo chiamato remove.
```js
assert(
@@ -84,7 +84,7 @@ assert(
);
```
-The remove method should remove the greatest element from the max heap while maintaining the max heap property.
+Il metodo remove dovrebbe rimuovere l'elemento più grande dal max heap mantenendo la proprietà max heap.
```js
assert(
@@ -114,21 +114,29 @@ assert(
## --seed-contents--
```js
-var MaxHeap = function() {
- this.heap = [null];
- this.insert = (ele) => {
- var index = this.heap.length;
- var arr = [...this.heap];
- arr.push(ele);
- while (ele > arr[Math.floor(index / 2)] && index > 1) {
- arr[index] = arr[Math.floor(index / 2)];
- arr[Math.floor(index / 2)] = ele;
- index = arr[Math.floor(index / 2)];
+var MaxHeap = function () {
+ this.heap = [];
+ this.parent = index => {
+ return Math.floor((index - 1) / 2);
+ }
+ this.insert = element => {
+ this.heap.push(element);
+ this.heapifyUp(this.heap.length - 1);
+ }
+ this.heapifyUp = index => {
+ let currentIndex = index,
+ parentIndex = this.parent(currentIndex);
+ while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
+ this.swap(currentIndex, parentIndex);
+ currentIndex = parentIndex;
+ parentIndex = this.parent(parentIndex);
}
- this.heap = arr;
+ }
+ this.swap = (index1, index2) => {
+ [this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
}
this.print = () => {
- return this.heap.slice(1);
+ return this.heap;
}
// Only change code below this line
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index.md
index 9a8e59f77f..7c17dd9917 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list-by-index.md
@@ -1,6 +1,6 @@
---
id: 587d8251367417b2b2512c65
-title: Remove Elements from a Linked List by Index
+title: Rimuovere gli elementi da una lista concatenata usando l'indice
challengeType: 1
forumTopicId: 301711
dashedName: remove-elements-from-a-linked-list-by-index
@@ -8,23 +8,23 @@ dashedName: remove-elements-from-a-linked-list-by-index
# --description--
-Before we move on to another data structure, let's get a couple of last bits of practice with linked lists.
+Prima di passare ad un'altra struttura di dati, otteniamo un altro po' di pratica con liste concatenate.
-Let's write a `removeAt` method that removes the `element` at a given `index`. The method should be called `removeAt(index)`. To remove an `element` at a certain `index`, we'll need to keep a running count of each node as we move along the linked list.
+Scriviamo un metodo `removeAt` che rimuove l'elemento `element` in un dato `index`. Il metodo dovrebbe essere chiamato `removeAt(index)`. Per rimuovere un `element` a un certo `index`, avremo bisogno di mantenere un conteggio in esecuzione di ogni nodo mentre ci muoviamo lungo la lista concatenata.
-A common technique used to iterate through the elements of a linked list involves a 'runner', or sentinel, that 'points' at the nodes that your code is comparing. In our case, starting at the `head` of our list, we start with a `currentIndex` variable that starts at `0`. The `currentIndex` should increment by one for each node we pass.
+Una tecnica comune utilizzata per iterare attraverso gli elementi di una lista concatenata comporta un 'runner', o sentinella, che 'punti' ai nodi che il tuo codice sta confrontando. Nel nostro caso, a partire dalla `head` della nostra lista, iniziamo con una variabile `currentIndex` che inizia da `0`. Il `currentIndex` dovrebbe aumentare di uno per ogni nodo che passiamo.
-Just like our `remove(element)` method, which [we covered in a previous lesson](/learn/coding-interview-prep/data-structures/remove-elements-from-a-linked-list), we need to be careful not to orphan the rest of our list when we remove the node in our `removeAt(index)` method. We keep our nodes contiguous by making sure that the node that has reference to the removed node has a reference to the next node.
+Proprio come il nostro metodo `remove(element)`, che [abbiamo coperto in una lezione precedente](/italian/learn/coding-interview-prep/data-structures/remove-elements-from-a-linked-list), dobbiamo stare attenti a non rendere orfano il resto della nostra lista quando rimuoviamo il nodo nel nostro metodo `removeAt(index)`. Manteniamo i nostri nodi contigui assicurandoci che il nodo che fa riferimento al nodo rimosso abbia un riferimento al nodo successivo.
# --instructions--
-Write a `removeAt(index)` method that removes and returns a node at a given `index`. The method should return `null` if the given `index` is either negative, or greater than or equal to the `length` of the linked list.
+Scrivi un metodo `removeAt(index)` che rimuove e restituisce un nodo a un certo `index`. Il metodo dovrebbe restituire `null` se l'`index` dato è o negativo, o superiore o uguale alla `length` della lista concatenata.
-**Note:** Remember to keep count of the `currentIndex`.
+**Nota:** Ricordati di mantenere il conteggio del `currentIndex`.
# --hints--
-Your `LinkedList` class should have a `removeAt` method.
+La tua classe `LinkedList` dovrebbe avere un metodo `removeAt`.
```js
assert(
@@ -35,7 +35,7 @@ assert(
);
```
-Your `removeAt` method should reduce the `length` of the linked list by one.
+Il tuo metodo `removeAt` dovrebbe ridurre `length` della lista collegata di uno.
```js
assert(
@@ -50,7 +50,7 @@ assert(
);
```
-Your `removeAt` method should remove the element at the specified index from the linked list.
+Il tuo metodo `removeAt` dovrebbe rimuovere l'elemento all'indice specificato dalla lista collegata.
```js
assert(
@@ -69,7 +69,7 @@ assert(
);
```
-When only one element is present in the linked list, your `removeAt` method should remove and return the element at specified index, and reduce the length of the linked list.
+Quando un solo elemento è presente nell'elenco collegato, il tuo metodo `removeAt` dovrebbe rimuovere e restituire l'elemento all'indice specificato e ridurre la lunghezza della lista concatenata.
```js
assert(
@@ -82,7 +82,7 @@ assert(
);
```
-Your `removeAt` method should return the element of the removed node.
+Il metodo `removeAt` dovrebbe restituire l'elemento del nodo rimosso.
```js
assert(
@@ -96,7 +96,7 @@ assert(
);
```
-Your `removeAt` method should return `null` and the linked list should not change if the given index is less than `0`.
+Il tuo metodo `removeAt` dovrebbe restituire `null` e la lista concatenata non dovrebbe cambiare se l'indice dato è inferiore a `0`.
```js
assert(
@@ -115,7 +115,7 @@ assert(
);
```
-Your `removeAt` method should return `null` and the linked list should not change if the given index is greater than or equal to the `length` of the list.
+Il tuo metodo `removeAt` dovrebbe restituire `null` e la lista concatenata non dovrebbe cambiare se l'indice dato è maggiore o uguale a `length` dell'elenco.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md
index a202036ff0..af03773649 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/remove-elements-from-a-linked-list.md
@@ -1,6 +1,6 @@
---
id: 587d8251367417b2b2512c63
-title: Remove Elements from a Linked List
+title: Rimuovi gli elementi da una lista concatenata
challengeType: 1
forumTopicId: 301712
dashedName: remove-elements-from-a-linked-list
@@ -8,23 +8,23 @@ dashedName: remove-elements-from-a-linked-list
# --description--
-The next important method that any implementation of a linked list will need is a `remove` method. This method should take the element we want to remove as an argument, and then search the list to find and remove the node that contains that element.
+Il metodo successivo importante che ogni implementazione di una lista concatenata avrà bisogno è un metodo `remove`. Questo metodo dovrebbe prendere l'elemento che vogliamo rimuovere come un argomento, e quindi cercare l'elenco per trovare e rimuovere il nodo che contiene quell'elemento.
-Whenever we remove a node from a linked list, it's important that we don't accidentally orphan the rest of the list in doing so. Recall that every node's `next` property points to the node that follows it in the list. If we're removing the middle element, say, we'll want to make sure that we have a connection from that element's previous node's `next` property to the middle element's `next` property (which is the next node in the list!)
+Ogni volta che rimuovi un nodo da una lista collegata, è importante che non orfani accidentalmente il resto della lista nel farlo. Ricorda che la proprietà `next` di ogni nodo punta al nodo che lo segue nella lista. Se stiamo rimuovendo l'elemento di mezzo, vogliamo fare in modo che c'è una connessione tra la proprietà `next` dell'elemento precedente e la proprietà `next` dell'elemento di mezzo (che è il nodo seguente nella lista!)
-This might sound really confusing, so let's return to the conga line example so we have a good conceptual model. Picture yourself in a conga line, and the person directly in front of you leaves the line. The person who just left the line no longer has her hands on anyone in line--and you no longer have your hands on the person that left. You step forward and put your hands on next person you see.
+Questo può essere davvero confusionario, quindi ritornaimo all'esempio del trenino così abbiamo un buon modello concettuale. Immaginati in un trenino, e la persona direttamente davanti a te lascia la fila. La persona che ha appena lasciato la fina non ha più le mani sulle spalle di nessuno, e tu non hai più le mani sulle spalle della persona che se ne è andata. Fai un passo avanti e metti le mani sulle spalle della persona davanti a te.
-If the element we wish to remove is the `head` element, we reassign the `head` to the second node of the linked list.
+Se l'elemento che vogliamo rimuovere è l'elemento `head`, assegniamo `head` al secondo nodo della lista concatenata.
# --instructions--
-Write a `remove` method that takes an element and removes it from the linked list.
+Scrivi un metodo `remove` che prende un elemento e lo rimuove dalla lista collegata.
-**Note:** The `length` of the list should decrease by one every time an element is removed from the linked list.
+**Nota:** La lunghezza della lista dovrebbe diminuire di uno ogni volta che un elemento viene rimosso dalla lista collegata.
# --hints--
-Your `LinkedList` class should have a `remove` method.
+La tua classe `LinkedList` dovrebbe avere un metodo `remove`.
```js
assert(
@@ -35,7 +35,7 @@ assert(
);
```
-Your `remove` method should reassign `head` to the second node when the first node is removed.
+Il tuo metodo `remove` dovrebbe riassegnare `head` al secondo nodo quando il primo nodo è rimosso.
```js
assert(
@@ -49,7 +49,7 @@ assert(
);
```
-Your `remove` method should decrease the `length` of the linked list by one for every node removed.
+Il tuo metodo `remove` dovrebbe diminuire `length` della lista concatenata di uno per ogni nodo rimosso.
```js
assert(
@@ -65,7 +65,7 @@ assert(
);
```
-Your `remove` method should reassign the reference of the previous node of the removed node to the removed node's `next` reference.
+Il tuo metodo `remove` dovrebbe riassegnara il riferimento del nodo precedente del nodo rimosso al rifermento `next` del nodo rimosso.
```js
assert(
@@ -81,7 +81,7 @@ assert(
);
```
-Your `remove` method should not change the linked list if the element does not exist in the linked list.
+Il tuo metodo `remove` non dovrebbe cambiare la lista concatenata se l'elemento non esiste nella lista concatenata.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/search-within-a-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/search-within-a-linked-list.md
index 03361689fe..e17f29b048 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/search-within-a-linked-list.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/search-within-a-linked-list.md
@@ -1,6 +1,6 @@
---
id: 587d8251367417b2b2512c64
-title: Search within a Linked List
+title: Cercare in una lista concatenata
challengeType: 1
forumTopicId: 301715
dashedName: search-within-a-linked-list
@@ -8,19 +8,19 @@ dashedName: search-within-a-linked-list
# --description--
-Let's add a few more useful methods to our linked list class. Wouldn't it be useful if we could tell if our list was empty or not, as with our `Stack` and `Queue` classes?
+Aggiungiamo alcuni altri metodi utili alla nostra classe di lista concatenata. Non sarebbe utile se potessimo dire se la nostra lista sia vuota o no, come con le nostre classi `Stack` e `Queue`?
-We should also be able to find specific elements in our linked list. Traversing through data structures is something you'll want to get a lot of practice with! Let's create an `indexOf` method that takes an `element` as an argument, and returns that element's `index` in the linked list. If the element is not found in the linked list, return `-1`.
+Dovremmo anche essere in grado di trovare elementi specifici nella nostra lista concatenata. Traversare strutture di dati è qualcosa con cui vorrai fare un sacco di pratica! Creiamo un metodo `indexOf` che prende `element` coem argomento, e restituisce l'`index` di quell'elemento nella lista concatenata. Se l'elemento non è trovato nella lista collegata, restituisci `-1`.
-Let's also implement a method that does the opposite: an `elementAt` method that takes an `index` as an argument and returns the `element` at the given `index`. If no `element` is found, return `undefined`.
+Implementiamo pure un metodo che fa l'opposto: un metodo `elementAt` che accetta un `index` come argomento e restituisce `element` al dato `index`. Se nessun elemento `element` è trovato, restituisci `undefined`.
# --instructions--
-Write an `isEmpty` method that checks if the linked list is empty, an `indexOf` method that returns the `index` of a given element, and an `elementAt` that returns an `element` at a given `index.`
+Scrivi un metodo `isEmpty` che verifica se la lista concatenata è vuota, un metodo `indexOf` che restituisce l'`index` di un dato elemento, e un metodo `elementAt` che restituisce l'`element` al dato `index.`
# --hints--
-Your `LinkedList` class should have an `isEmpty` method.
+La tua classe `LinkedList` dovrebbe avere un metodo `isEmpty`.
```js
assert(
@@ -31,7 +31,7 @@ assert(
);
```
-Your `isEmpty` method should return `false` when there is at least one element in linked list.
+Il tuo metodo `isEmpty` dovrebbe restituire `false` quando c'è almeno un elemento nella lista concatenata.
```js
assert(
@@ -45,7 +45,7 @@ assert(
);
```
-Your `isEmpty` method should return `true` when there are no elements in linked list.
+Il tuo metodo `isEmpty` dovrebbe restituire `true` quando non ci sono elementi nella lista concatenata.
```js
assert(
@@ -56,7 +56,7 @@ assert(
);
```
-Your `LinkedList` class should have an `indexOf` method.
+La tua classe `LinkedList` dovrebbe avere un metodo `indexOf`.
```js
assert(
@@ -67,7 +67,7 @@ assert(
);
```
-Your `indexOf` method should return the index of a given element found in linked list.
+Il tuo metodo `indexOf` dovrebbe restituire l'indice di un dato elemento trovato nella lista concatenata.
```js
assert(
@@ -81,7 +81,7 @@ assert(
);
```
-Your `indexOf` method should return `-1` if the given element is not found in linked list
+Il tuo metodo `indexOf` dovrebbe restituire `-1` se l'elemento dato non è trovato nella lista concatenata
```js
assert(
@@ -95,7 +95,7 @@ assert(
);
```
-Your `LinkedList` class should have an `elementAt` method.
+La tua classe `LinkedList` dovrebbe avere un metodo `elementAt`.
```js
assert(
@@ -106,7 +106,7 @@ assert(
);
```
-Your `elementAt` method should return the element found at a given index in linked list.
+Il tuo metodo `elementAt` dovrebbe restituire l'elemento trovato in un dato indice nella lista concatenata.
```js
assert(
@@ -120,7 +120,7 @@ assert(
);
```
-Your `elementAt` method should return `undefined` if the given element is not found at a given index in linked list.
+Il tuo `elementAt` metodo dovrebbe restituire `undefined` se l'elemento dato non è trovato in un dato indice nella lista concatenata.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/typed-arrays.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/typed-arrays.md
index b992af729a..23a3b80b1d 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/typed-arrays.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/typed-arrays.md
@@ -1,6 +1,6 @@
---
id: 587d8253367417b2b2512c6a
-title: Typed Arrays
+title: Array Digitati
challengeType: 1
forumTopicId: 301716
dashedName: typed-arrays
@@ -8,21 +8,21 @@ dashedName: typed-arrays
# --description--
-Arrays are JavaScript objects that can hold a lot of different elements.
+Gli array sono oggetti JavaScript che possono contenere molti elementi diversi.
```js
var complexArr = [1, 5, "2", "Word", {"name": "James"}];
```
-Basically what happens in the background is that your browser will automatically give the right amount of memory space for that array. It will also change as needed if you add or remove data.
+Fondamentalmente ciò che accade in background è che il browser darà automaticamente la giusta quantità di spazio di memoria per quell'array. Cambierà anche al bisogno se si aggiungono o rimuovono i dati.
-However, in the world of high performance and different element types, sometimes you need to be more specific on how much memory is given to an array.
+Tuttavia, nel mondo delle alte prestazioni e dei diversi tipi di elementi, a volte è necessario essere più specifici su quanto memoria viene dato a un array.
-Typed arrays are the answer to this problem. You are now able to say how much memory you want to give an array. Below is a basic overview of the different types of arrays available and the size in bytes for each element in that array.
+Gli array digitati sono la risposta a questo problema. Ora sei in grado di dire quanta memoria vuoi allocare per un dato array. Di seguito una panoramica di base dei diversi tipi di array disponibili e la dimensione in byte per ogni elemento in quell'array.
-Type | Each element size in bytes |
---|
Int8Array | 1 |
Uint8Array | 1 |
Uint8ClampedArray | 1 |
Int16Array | 2 |
Uint16Array | 2 |
Int32Array | 4 |
Uint32Array | 4 |
Float32Array | 4 |
Float64Array | 8 |
+Tipo | La dimensione di ogni elemento in byte |
---|
Int8Array | 1 |
Uint8Array | 1 |
Uint8ClampedArray | 1 |
Int16Array | 2 |
Uint16Array | 2 |
Int32Array | 4 |
Uint32Array | 4 |
Float32Array | 4 |
Float64Array | 8 |
-There are two ways in creating these kind of arrays. One way is to create it directly. Below is how to create a 3 length `Int16Array`.
+Ci sono due modi per creare questi tipi di array. Un modo è di crearli direttamente. Di seguito è riportato come creare un `Int16Array` di lunghezza 3.
```js
var i8 = new Int16Array(3);
@@ -30,8 +30,8 @@ console.log(i8);
// Returns [0, 0, 0]
```
-You can also create a buffer to assign how much data (in bytes) you want the array to take up. **Note**
-To create typed arrays using buffers, you need to assign the number of bytes to be a multiple of the bytes listed above.
+Puoi ache creare un buffer per assegnare quanti dati (in byte) vuoi che il tuo array occupi. **Nota**
+Per creare array digitat usando buffer, devi assegnare il numero di byte come multiple dei byte elencati precedentemente.
```js
// Create same Int16Array array differently
@@ -43,35 +43,35 @@ i8View.byteLength; // Returns 6
console.log(i8View); // Returns [0, 0, 0]
```
-Buffers are general purpose objects that just carry data. You cannot access them normally. To access them, you need to first create a view.
+I buffer sono oggetti a scopo generico che contengono solo dati. Non puoi accedervi normalmente. Per accederci devi prima creare una view.
```js
i8View[0] = 42;
console.log(i8View); // Returns [42, 0, 0]
```
-**Note**
-Typed arrays do not have some of the methods traditional arrays have such as `.pop()` or `.push()`. Typed arrays also fail `Array.isArray()` that checks if something is an array. Although simpler, this can be an advantage for less-sophisticated JavaScript engines to implement them.
+**Nota**
+Array digitati non hanno alcuni dei metodi degli array tradizioni come `.pop()` o `.push()`. Gli array digitati fanno restituire false ad `Array.isArray()` che controlla se qualcosa è un array. Anche se più semplice, questo può essere un vantaggio per i motori JavaScript meno sofisticati per implementarli.
# --instructions--
-First create a `buffer` that is 64-bytes. Then create a `Int32Array` typed array with a view of it called `i32View`.
+Come prima cosa crea un `buffer` che è 64 byte. Quindi crea un array digitato `Int32Array` con una view chiamata `i32View`.
# --hints--
-Your `buffer` should be 64 bytes large.
+Il tuo `buffer` dovrebbe occupare 64 byte.
```js
assert(buffer.byteLength === 64);
```
-Your `i32View` view of your buffer should be 64 bytes large.
+La tua view `i32View` del tuo buffer dovrebbe occupare 64 byte.
```js
assert(i32View.byteLength === 64);
```
-Your `i32View` view of your buffer should be 16 elements long.
+La tua view `i32View` del tuo buffer dovrebbe avere 16 elementi.
```js
assert(i32View.length === 16);
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set.md
index 55d4ac67de..de0ebdcc95 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-.has-and-.size-on-an-es6-set.md
@@ -1,6 +1,6 @@
---
id: 587d8255367417b2b2512c72
-title: Use .has and .size on an ES6 Set
+title: Usare .has e .size su un set ES6
challengeType: 1
forumTopicId: 301717
dashedName: use--has-and--size-on-an-es6-set
@@ -8,21 +8,21 @@ dashedName: use--has-and--size-on-an-es6-set
# --description--
-Let's look at the .has and .size methods available on the ES6 Set object.
+Diamo un'occhiata ai metodi .has e .size disponibili sull'oggetto Set ES6.
-First, create an ES6 Set
+Per prima cosa, crea un Set ES6
```js
var set = new Set([1,2,3]);
```
-The .has method will check if the value is contained within the set.
+Il metodo .has controllerà se il valore è contenuto all'interno del set.
```js
var hasTwo = set.has(2);
```
-The .size method will return an integer representing the size of the Set
+Il metodo .size restituirà un numero intero rappresentante la dimensione del Set
```js
var howBig = set.size;
@@ -30,11 +30,11 @@ var howBig = set.size;
# --instructions--
-In this exercise we will pass an array and a value to the checkSet() function. Your function should create an ES6 set from the array argument. Find if the set contains the value argument. Find the size of the set. And return those two values in an array.
+In questo esercizio passeremo un array e un valore alla funzione checkSet(). La tua funzione dovrebbe creare un set ES& dall'argomento array. Scopri se il set contiene il valore argomento. Trova la dimensione del set. E restituire questi due valori in un array.
# --hints--
-`checkSet([4, 5, 6], 3)` should return [ false, 3 ]
+`checkSet([4, 5, 6], 3)` dovrebbe restituire [ false, 3 ]
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md
index b02f10043d..74b6bdd7ee 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-breadth-first-search-in-a-binary-search-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8258367417b2b2512c7f
-title: Use Breadth First Search in a Binary Search Tree
+title: Una la ricerca in ampiezza nella ricerca binaria in un albero
challengeType: 1
forumTopicId: 301718
dashedName: use-breadth-first-search-in-a-binary-search-tree
@@ -8,17 +8,17 @@ dashedName: use-breadth-first-search-in-a-binary-search-tree
# --description--
-Here we will introduce another tree traversal method: breadth-first search. In contrast to the depth-first search methods from the last challenge, breadth-first search explores all the nodes in a given level within a tree before continuing on to the next level. Typically, queues are utilized as helper data structures in the design of breadth-first search algorithms.
+Qui introdurremo un altro metodo traversale di albero: la ricerca in ampiezza. In contrasto con il metodo di ricerca in profondità dell'ultima sfida, La ricerca in ampiezza esplora tutti i nodi in un dato livello all'interno di un albero prima di continuare al livello successivo. Tipicamente, le code sono utilizzate come strutture di dati helper nella progettazione di algoritmi di ricerca in ampiezza.
-In this method, we start by adding the root node to a queue. Then we begin a loop where we dequeue the first item in the queue, add it to a new array, and then inspect both its child subtrees. If its children are not null, they are each enqueued. This process continues until the queue is empty.
+In questo metodo, iniziamo aggiungendo il nodo radice alla coda. Poi iniziamo un ciclo in cui decodiamo il primo elemento nella coda, aggiungerlo a un nuovo array, e quindi ispezionare entrambi i suoi sottalberi. Se i suoi figli non sono nulli, sono ciascuno messo in coda. Questo processo continua fino a quando la coda non è vuota.
# --instructions--
-Let's create a breadth-first search method in our tree called `levelOrder`. This method should return an array containing the values of all the tree nodes, explored in a breadth-first manner. Be sure to return the values in the array, not the nodes themselves. A level should be traversed from left to right. Next, let's write a similar method called `reverseLevelOrder` which performs the same search but in the reverse direction (right to left) at each level.
+Creiamo un metodo di ricerca in ampiezza nel nostro albero chiamato `levelOrder`. Questo metodo dovrebbe restituire un array contenente i valori di tutti i nodi degli alberi, esplorati con la ricerca in ampiezza. Assicurati di restituire i valori nell'array, non i nodi stessi. Un livello dovrebbe essere attraversato da sinistra a destra. Poi scriviamo un metodo simile chiamato `reverseLevelOrder` che esegue la stessa ricerca ma nella direzione inversa (da destra a sinistra) ad ogni livello.
# --hints--
-The `BinarySearchTree` data structure should exist.
+La struttura di dati `BinarySearchTree` dovrebbe esistere.
```js
assert(
@@ -32,7 +32,7 @@ assert(
);
```
-The binary search tree should have a method called `levelOrder`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `levelOrder`.
```js
assert(
@@ -48,7 +48,7 @@ assert(
);
```
-The binary search tree should have a method called `reverseLevelOrder`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `reverseLevelOrder`.
```js
assert(
@@ -64,7 +64,7 @@ assert(
);
```
-The `levelOrder` method should return an array of the tree node values explored in level order.
+Il metodo `levelOrder` dovrebbe restituire un array dei valori del nodo albero esplorati in ordine di livello.
```js
assert(
@@ -94,7 +94,7 @@ assert(
);
```
-The `reverseLevelOrder` method should return an array of the tree node values explored in reverse level order.
+Il metodo `reverseLevelOrder` dovrebbe restituire un array dei valori del nodo albero esplorati in ordine di livello inverso.
```js
assert(
@@ -124,7 +124,7 @@ assert(
);
```
-The `levelOrder` method should return `null` for an empty tree.
+Il metodo `levelOrder` dovrebbe restituire `null` per un albero vuoto.
```js
assert(
@@ -143,7 +143,7 @@ assert(
);
```
-The `reverseLevelOrder` method should return `null` for an empty tree.
+Il metodo `reverseLevelOrder` dovrebbe restituire `null` per un albero vuoto.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md
index c03fb75077..10ac9046c9 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-depth-first-search-in-a-binary-search-tree.md
@@ -1,6 +1,6 @@
---
id: 587d8257367417b2b2512c7e
-title: Use Depth First Search in a Binary Search Tree
+title: Usa la ricerca in profondità in un alvero di ricerca binario
challengeType: 1
forumTopicId: 301719
dashedName: use-depth-first-search-in-a-binary-search-tree
@@ -8,15 +8,15 @@ dashedName: use-depth-first-search-in-a-binary-search-tree
# --description--
-We know how to search a binary search tree for a specific value. But what if we just want to explore the entire tree? Or what if we don't have an ordered tree and we need to just search for a value? Here we will introduce some tree traversal methods which can be used to explore tree data structures. First up is depth-first search. In depth-first search, a given subtree is explored as deeply as possible before the search continues on to another subtree. There are three ways this can be done: In-order: Begin the search at the left-most node and end at the right-most node. Pre-order: Explore all the roots before the leaves. Post-order: Explore all the leaves before the roots. As you may guess, you may choose different search methods depending on what type of data your tree is storing and what you are looking for. For a binary search tree, an inorder traversal returns the nodes in sorted order.
+Sappiamo come cercare un albero di ricerca binario per un valore specifico. Ma cosa succede se vogliamo solo esplorare l'intero albero? O cosa succede se non abbiamo un albero ordinato e dobbiamo solo cercare un valore? Qui introdurremo alcuni metodi di per traversare l'alvero che possono essere utilizzati per esplorare strutture dati ad albero. Il primo è la prima ricerca in profondità. Nella ricerca in profondità, un dato sotto-albero è esplorato il più profondamente possibile prima che la ricerca continui su un altro sotto-albero. Ci sono tre modi per farlo: In ordine: Iniziare la ricerca al nodo più a sinistra e terminare al nodo più a destra. Pre-ordine: Esplora tutte le radici prima delle foglie. Post-order: Esplora tutte le foglie prima delle radici. Come si può immaginare, è possibile scegliere diversi metodi di ricerca a seconda del tipo di dati che l'albero sta memorizzando e quello che stai cercando. Per un albero di ricerca binario, un attraversamento in ordine restituisce i nodi ordinati.
# --instructions--
-Here we will create these three search methods on our binary search tree. Depth-first search is an inherently recursive operation which continues to explore further subtrees so long as child nodes are present. Once you understand this basic concept, you can simply rearrange the order in which you explore the nodes and subtrees to produce any of the three searches above. For example, in post-order search we would want to recurse all the way to a leaf node before we begin to return any of the nodes themselves, whereas in pre-order search we would want to return the nodes first, and then continue recursing down the tree. Define `inorder`, `preorder`, and `postorder` methods on our tree. Each of these methods should return an array of items which represent the tree traversal. Be sure to return the integer values at each node in the array, not the nodes themselves. Finally, return `null` if the tree is empty.
+Qui creeremo questi tre metodi di ricerca sul nostro albero di ricerca binario. La ricerca di profondità prima è un'operazione intrinsecamente ricorsiva che continua ad esplorare ulteriori sottalberi, a condizione che siano presenti nodi figli. Una volta che capisci questo concetto fondamentale, si può semplicemente riorganizzare l'ordine in cui si esplorano i nodi e sotto-alberi per produrre una delle tre ricerche sopra. Ad esempio, nella ricerca post-ordine vorremmo arrivare ad un nodo foglia prima di iniziare a restituire uno dei nodi stessi, mentre in pre-ordine di ricerca vorremmo restituire i nodi prima, e poi continuare a ricorsare giù l'albero. Definisci i metodi `inorder`, `preorder`e `postorder` sul nostro albero. Ognuno di questi metodi dovrebbe restituire una serie di oggetti che rappresentano il traversale ad albero. Assicurati di restituire i valori interi ad ogni nodo dell'array, non i nodi stessi. Infine, restituisci `null` se l'albero è vuoto.
# --hints--
-The `BinarySearchTree` data structure should exist.
+La struttura dati `BinarySearchTree` dovrebbe esistere.
```js
assert(
@@ -30,7 +30,7 @@ assert(
);
```
-The binary search tree should have a method called `inorder`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `inorder`.
```js
assert(
@@ -46,7 +46,7 @@ assert(
);
```
-The binary search tree should have a method called `preorder`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `preorder`.
```js
assert(
@@ -62,7 +62,7 @@ assert(
);
```
-The binary search tree should have a method called `postorder`.
+L'albero di ricerca binario dovrebbe avere un metodo chiamato `postorder`.
```js
assert(
@@ -78,7 +78,7 @@ assert(
);
```
-The `inorder` method should return an array of the node values that result from an inorder traversal.
+Il metodo `inorder` dovrebbe restituire un array dei valori del nodo che risultano da un traversamento inorder.
```js
assert(
@@ -108,7 +108,7 @@ assert(
);
```
-The `preorder` method should return an array of the node values that result from a preorder traversal.
+Il metodo `preorder` dovrebbe restituire un array dei valori del nodo che risultano da un attraversamento preorder.
```js
assert(
@@ -138,7 +138,7 @@ assert(
);
```
-The `postorder` method should return an array of the node values that result from a postorder traversal.
+Il metodo `postorder` dovrebbe restituire un array dei valori del nodo che risultano da un traversamento postordine.
```js
assert(
@@ -168,7 +168,7 @@ assert(
);
```
-The `inorder` method should return `null` for an empty tree.
+Il metodo `inorder` dovrebbe restituire `null` per un albero vuoto.
```js
assert(
@@ -187,7 +187,7 @@ assert(
);
```
-The `preorder` method should return `null` for an empty tree.
+Il metodo `preorder` dovrebbe restituire `null` per un albero vuoto.
```js
assert(
@@ -206,7 +206,7 @@ assert(
);
```
-The `postorder` method should return `null` for an empty tree.
+Il metodo `postorder` dovrebbe restituire `null` per un albero vuoto.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration.md
index 79ba7313b8..42690e7ac7 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/use-spread-and-notes-for-es5-set-integration.md
@@ -1,6 +1,6 @@
---
id: 587d8255367417b2b2512c73
-title: Use Spread and Notes for ES5 Set() Integration
+title: Usare sprea e notes per integrazione del Set() ES5
challengeType: 1
forumTopicId: 301720
dashedName: use-spread-and-notes-for-es5-set-integration
@@ -8,11 +8,11 @@ dashedName: use-spread-and-notes-for-es5-set-integration
# --description--
-Do you remember the ES6 spread operator `...`?
+Ricordi l'operatore di diffusione in ES6 `...`?
-`...` can take iterable objects in ES6 and turn them into arrays.
+`...` può prendere oggetti iterabili in ES6 e trasformarli in array.
-Let's create a Set, and check out the spread function.
+Creiamo un Set e controlliamo la funzione di diffusione.
```js
var set = new Set([1,2,3]);
@@ -22,13 +22,13 @@ console.log(setToArr) // returns [ 1, 2, 3 ]
# --instructions--
-In this exercise we will pass a set object to the `checkSet` function. It should return an array containing the values of the Set.
+In questo esercizio passeremo un oggetto set alla funzione `checkSet`. Dovrebbe restituire un array contenente i valori del Set.
-Now you've successfully learned how to use the ES6 `Set()` object, good job!
+Ora hai imparato con successo come usare l'oggetto ES6 `Set()`, buon lavoro!
# --hints--
-`checkSet(new Set([1,2,3,4,5,6,7])` should return `[1, 2, 3, 4, 5, 6, 7]`.
+`checkSet(new Set([1,2,3,4,5,6,7])` dovrebbe restituire `[1, 2, 3, 4, 5, 6, 7]`.
```js
assert(
diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list.md
index c746995d5d..56bd0ae14c 100644
--- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list.md
+++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list.md
@@ -1,6 +1,6 @@
---
id: 587d8251367417b2b2512c61
-title: Work with Nodes in a Linked List
+title: Lavorare con i nodi in una lista concatenata
challengeType: 1
forumTopicId: 301721
dashedName: work-with-nodes-in-a-linked-list
@@ -8,25 +8,25 @@ dashedName: work-with-nodes-in-a-linked-list
# --description--
-Another common data structure you'll run into in computer science is the linked list. A linked list is a linear collection of data elements, called 'nodes', each of which points to the next. Each node in a linked list contains two key pieces of information: the `element` itself, and a reference to the next `node`.
+Un'altra struttura dati che incontrerai in computer science è la lista concatenata. Una lista concatenata è una collezione lineare di elementi di dati, chiamati nodi, ognuno dei quali fa riferimento al successivo. Ogni nodo in una lista concatenata contiene due informazioni fondamentali: l'elemento stesso, e un riferimento al nodo successivo.
-Imagine that you are in a conga line. You have your hands on the next person in the line, and the person behind you has their hands on you. You can see the person straight ahead of you, but they are blocking the view of the other people ahead in line. A node is just like a person in a conga line: they know who they are and they can only see the next person in line, but they are not aware of the other people ahead or behind them.
+Immagina di essere in un trenino. Hai le mani sulle spalle della persona davanti a te in fila, e la persona dietro di te ha le mani sulle tue spalle. Puoi vedere la persona direttamente di fronte a te, ma stanno bloccando la vista delle altre persone più in la nel trenino. Un nodo è proprio come una persona in un trenino: sanno chi sono e possono vedere solo la persona successiva nella fila, ma non sono a conoscenza delle altre persone davanti o dietro di loro.
# --instructions--
-In our code editor, we've created two nodes, `Kitten` and `Puppy`, and we've manually connected the `Kitten` node to the `Puppy` node.
+Nel nostro editor di codice, abbiamo creato due noti, `Kitten` e `Puppy`, e abbiamo connesso il nodo `Kitten` al nodo`Puppy`.
-Create a `Cat` and `Dog` node and manually add them to the line.
+Crea dei nodi `Cat` e `Dog` e aggiungili manualmente alla lista.
# --hints--
-Your `Puppy` node should have a reference to a `Cat` node.
+Il tuo nodo `Puppy` dovrebbe avere un riferimento a un nodo `Cat`.
```js
assert(Puppy.next.element === 'Cat');
```
-Your `Cat` node should have a reference to a `Dog` node.
+Il tuo nodo `Cat` dovrebbe avere un riferimento a un nodo `Dog`.
```js
assert(Cat.next.element === 'Dog');
diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md b/curriculum/challenges/portuguese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
index 46c696b850..ccdad503aa 100644
--- a/curriculum/challenges/portuguese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
+++ b/curriculum/challenges/portuguese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
@@ -17,7 +17,7 @@ Se você estivesse escrevendo um artigo com uma introdução, um corpo e uma con
Títulos com classificação igual (ou superior) iniciam novas seções, títulos com classificação inferior começam subseções dentro da seção pai.
-Por exemplo: uma página com um elemento `h2` seguido por várias subseções rotuladas com tags `h4` confundiria um usuário de leitor de tela. Como o HTML5 oferece 6 opções de títulos, pode ser tentador usar uma dessas tags apenas pelo tamanho da fonte que elas oferecem, mas você pode usar o CSS para alterar estes tamanhos.
+Por exemplo: uma página com um elemento `h2` seguido por várias subseções rotuladas com elementos `h4` confundiria um usuário de leitor de tela. Como o HTML5 oferece 6 opções de títulos, pode ser tentador usar uma dessas tags apenas pelo tamanho da fonte que elas oferecem, mas você pode usar o CSS para alterar estes tamanhos.
Uma última observação, cada página deve sempre ter um (e apenas um) elemento `h1`, que é o assunto principal do seu conteúdo. Este e outros cabeçalhos são usados em parte pelos mecanismos de pesquisa para entender o tópico da página.
@@ -27,7 +27,7 @@ O Camper Cat quer uma página no site dedicada a como se tornar um ninja. Ajude-
# --hints--
-O código deve ter 6 tags `h3`.
+O código deve ter 6 elementos `h3`.
```js
assert($('h3').length === 6);
@@ -39,7 +39,7 @@ O código deve ter 6 tags de fechamento `h3`.
assert((code.match(/\/h3/g) || []).length === 6);
```
-O código não deve ter nenhuma tag `h5`.
+O código não deve ter nenhum elemento `h5`.
```js
assert($('h5').length === 0);
diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element.md b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element.md
index 9191d7cdec..60d1c320b7 100644
--- a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element.md
+++ b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element.md
@@ -1,6 +1,6 @@
---
id: 587d781b367417b2b2512abd
-title: Contrastar o tamanho de um título com o de um parágrafo
+title: Contrastar o tamanho de um elemento de título com o de um parágrafo
challengeType: 0
videoUrl: 'https://scrimba.com/c/c3bRPTz'
forumTopicId: 301037
@@ -9,11 +9,11 @@ dashedName: adjust-the-size-of-a-heading-element-versus-a-paragraph-element
# --description--
-O tamanho da tipografia das tags de títulos (`h1` a `h6`) geralmente deve ser maior do que o tamanho da tipografia das tags de parágrafo. Isso torna mais fácil para o usuário entender visualmente o layout e o nível de importância de tudo na página. Você pode usar a propriedade `font-size` para ajustar o tamanho do texto de um elemento.
+O tamanho da tipografia dos elementos de título (`h1` a `h6`) geralmente deve ser maior do que o tamanho da tipografia dos elementos de parágrafo. Isso torna mais fácil para o usuário entender visualmente o layout e o nível de importância de tudo na página. Você pode usar a propriedade `font-size` para ajustar o tamanho do texto de um elemento.
# --instructions--
-Para tornar o título significativamente maior do que o parágrafo, altere a propriedade `font-size` da tag `h4` para 27 pixels.
+Para tornar o título significativamente maior do que o parágrafo, altere a propriedade `font-size` do elemento `h4` para 27 pixels.
# --hints--
@@ -116,3 +116,4 @@ assert($('h4').css('font-size') == '27px');
```
+
diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
index 753a7fbe10..0934b187da 100644
--- a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
+++ b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
@@ -13,7 +13,7 @@ Esta seção do currículo se concentra no Design Visual Aplicado. O primeiro gr
O texto costuma ser uma grande parte do conteúdo na web. O CSS possui várias opções de como alinhá-lo com a propriedade `text-align`.
-`text-align: justify;` faz com que todas as linhas de texto, exceto a última linha, encostem nas bordas esquerda e direita da caixa em que o texto está.
+`text-align: justify;` espaça o texto para que cada linha tenha a mesma largura.
`text-align: center;` centraliza o texto
diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.md b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.md
index c0b5dfaf56..f6e39e902b 100644
--- a/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.md
+++ b/curriculum/challenges/portuguese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.md
@@ -13,7 +13,7 @@ Para deixar o texto tachado, ou seja, para que uma linha horizontal corte os car
# --instructions--
-Envolva a tag `s` em torno da palavra `Google` que está dentro da tag `h4` e, em seguida, adicione a palavra `Alphabet` ao lado dela. Essa segunda palavra não deverá estar tachada.
+Envolva a tag `s` em torno da palavra `Google` que está dentro da tag `h4` e, em seguida, adicione a palavra `Alphabet` ao lado dela sem a formatação tachada.
# --hints--
diff --git a/curriculum/challenges/portuguese/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md b/curriculum/challenges/portuguese/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
index ed9593d27d..338d88dd2e 100644
--- a/curriculum/challenges/portuguese/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
+++ b/curriculum/challenges/portuguese/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
@@ -21,7 +21,7 @@ Abaixo, vemos um exemplo de um link vinculado a um elemento interno da página:
```
-Quando os usuários clicam no link `Contacts`, eles são levados à seção da página que contem o texto **Contacts**.
+Quando os usuários clicam no link `Contacts`, eles são levados à seção da página que contem o elemento de título **Contacts**.
# --instructions--
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
index 889331b47a..07b2f13da1 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
@@ -18,9 +18,9 @@ Os índices de um array são escritos na mesma notação com colchetes que as st
**Exemplo**
```js
-var array = [50,60,70];
+const array = [50, 60, 70];
array[0];
-var data = array[1];
+const data = array[1];
```
`array[0]` agora é `50` e `data` tem o valor `60`.
@@ -76,7 +76,7 @@ if(typeof myArray !== "undefined" && typeof myData !== "undefined"){(function(y,
## --seed-contents--
```js
-var myArray = [50,60,70];
+const myArray = [50, 60, 70];
```
@@ -84,6 +84,6 @@ var myArray = [50,60,70];
# --solutions--
```js
-var myArray = [50,60,70];
-var myData = myArray[0];
+const myArray = [50, 60, 70];
+const myData = myArray[0];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
index 841e497941..60d8694b95 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
@@ -14,12 +14,13 @@ Uma maneira de pensar em um array multidimensional é como um *array
**Exemplo**
```js
-var arr = [
- [1,2,3],
- [4,5,6],
- [7,8,9],
- [[10,11,12], 13, 14]
+const arr = [
+ [1, 2, 3],
+ [4, 5, 6],
+ [7, 8, 9],
+ [[10, 11, 12], 13, 14]
];
+
arr[3];
arr[3][0];
arr[3][0][1];
@@ -58,14 +59,19 @@ if(typeof myArray !== "undefined"){(function(){return "myData: " + myData + " my
## --seed-contents--
```js
-var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
+const myArray = [
+ [1, 2, 3],
+ [4, 5, 6],
+ [7, 8, 9],
+ [[10, 11, 12], 13, 14],
+];
-var myData = myArray[0][0];
+const myData = myArray[0][0];
```
# --solutions--
```js
-var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];
-var myData = myArray[2][1];
+const myArray = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [[10, 11, 12], 13, 14]];
+const myData = myArray[2][1];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
index d403cac91f..e8b7c5e3c9 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
@@ -14,7 +14,7 @@ Como vimos em exemplos anteriores, objetos podem conter tanto objetos aninhados
Aqui está um exemplo de como se acessar um array aninhado:
```js
-var ourPets = [
+const ourPets = [
{
animalType: "cat",
names: [
@@ -32,6 +32,7 @@ var ourPets = [
]
}
];
+
ourPets[0].names[1];
ourPets[1].names[0];
```
@@ -72,7 +73,7 @@ assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
## --seed-contents--
```js
-var myPlants = [
+const myPlants = [
{
type: "flowers",
list: [
@@ -91,13 +92,13 @@ var myPlants = [
}
];
-var secondTree = "";
+const secondTree = "";
```
# --solutions--
```js
-var myPlants = [
+const myPlants = [
{
type: "flowers",
list: [
@@ -116,5 +117,5 @@ var myPlants = [
}
];
-var secondTree = myPlants[1].list[1];
+const secondTree = myPlants[1].list[1];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
index 26dc990f75..1cab5c2811 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
@@ -14,7 +14,7 @@ As subpropriedades de objetos podem ser acessadas ao encadear a notação de pon
Aqui está um objeto aninhado:
```js
-var ourStorage = {
+const ourStorage = {
"desk": {
"drawer": "stapler"
},
@@ -26,6 +26,7 @@ var ourStorage = {
"bottom drawer": "soda"
}
};
+
ourStorage.cabinet["top drawer"].folder2;
ourStorage.desk.drawer;
```
@@ -66,7 +67,7 @@ assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
## --seed-contents--
```js
-var myStorage = {
+const myStorage = {
"car": {
"inside": {
"glove box": "maps",
@@ -78,13 +79,13 @@ var myStorage = {
}
};
-var gloveBoxContents = undefined;
+const gloveBoxContents = undefined;
```
# --solutions--
```js
-var myStorage = {
+const myStorage = {
"car":{
"inside":{
"glove box":"maps",
@@ -95,5 +96,5 @@ var myStorage = {
}
}
};
-var gloveBoxContents = myStorage.car.inside["glove box"];
+const gloveBoxContents = myStorage.car.inside["glove box"];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
index a906f8fc95..5986eb8a2e 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
@@ -16,11 +16,12 @@ No entanto, você ainda pode usar a notação de colchetes nas propriedades dos
Aqui está um exemplo usando a notação de colchetes para ler uma propriedade de um objeto:
```js
-var myObj = {
+const myObj = {
"Space Name": "Kirk",
"More Space": "Spock",
"NoSpace": "USS Enterprise"
};
+
myObj["Space Name"];
myObj['More Space'];
myObj["NoSpace"];
@@ -78,26 +79,25 @@ assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
```js
// Setup
-var testObj = {
+const testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};
// Only change code below this line
-
-var entreeValue = testObj; // Change this line
-var drinkValue = testObj; // Change this line
+const entreeValue = testObj; // Change this line
+const drinkValue = testObj; // Change this line
```
# --solutions--
```js
-var testObj = {
+const testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};
-var entreeValue = testObj["an entree"];
-var drinkValue = testObj['the drink'];
+const entreeValue = testObj["an entree"];
+const drinkValue = testObj['the drink'];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
index e9f70fe6ea..2b02189601 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
@@ -16,15 +16,17 @@ Notação de ponto é o que você utiliza quando você sabe o nome da propriedad
Aqui está um exemplo usando notação de ponto (`.`) para ler uma propriedade do objeto:
```js
-var myObj = {
+const myObj = {
prop1: "val1",
prop2: "val2"
};
-var prop1val = myObj.prop1;
-var prop2val = myObj.prop2;
+
+const prop1val = myObj.prop1;
+const prop2val = myObj.prop2;
```
`prop1val` teria o valor `val1` e `prop2val` teria o valor `val2`.
+
# --instructions--
Leia os valores de propriedade de `testObj` usando a notação de ponto. Defina a variável `hatValue` igual à propriedade `hat` do objeto e defina a variável `shirtValue` igual à propriedade `shirt` do objeto.
@@ -73,27 +75,26 @@ assert(code.match(/testObj\.\w+/g).length > 1);
```js
// Setup
-var testObj = {
+const testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};
// Only change code below this line
-
-var hatValue = testObj; // Change this line
-var shirtValue = testObj; // Change this line
+const hatValue = testObj; // Change this line
+const shirtValue = testObj; // Change this line
```
# --solutions--
```js
-var testObj = {
+const testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};
-var hatValue = testObj.hat;
-var shirtValue = testObj.shirt;
+const hatValue = testObj.hat;
+const shirtValue = testObj.shirt;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
index cd5cfc3d58..80ef872b15 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
@@ -14,11 +14,14 @@ Outro uso de notação de colchetes em objetos é para acessar a propriedade a q
Aqui está um exemplo de usar uma variável para acessar uma propriedade:
```js
-var dogs = {
- Fido: "Mutt", Hunter: "Doberman", Snoopie: "Beagle"
+const dogs = {
+ Fido: "Mutt",
+ Hunter: "Doberman",
+ Snoopie: "Beagle"
};
-var myDog = "Hunter";
-var myBreed = dogs[myDog];
+
+const myDog = "Hunter";
+const myBreed = dogs[myDog];
console.log(myBreed);
```
@@ -27,14 +30,16 @@ A string `Doberman` seria exibida no console.
Outra forma de você usar esse conceito é quando o nome da propriedade é coletado dinamicamente, durante a execução do programa, da seguinte forma:
```js
-var someObj = {
+const someObj = {
propName: "John"
};
+
function propPrefix(str) {
- var s = "prop";
+ const s = "prop";
return s + str;
}
-var someProp = propPrefix("Name");
+
+const someProp = propPrefix("Name");
console.log(someObj[someProp]);
```
@@ -96,26 +101,25 @@ if(typeof player !== "undefined"){(function(v){return v;})(player);}
```js
// Setup
-var testObj = {
+const testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
// Only change code below this line
-
-var playerNumber; // Change this line
-var player = testObj; // Change this line
+const playerNumber = 42; // Change this line
+const player = testObj; // Change this line
```
# --solutions--
```js
-var testObj = {
+const testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
-var playerNumber = 16;
-var player = testObj[playerNumber];
+const playerNumber = 16;
+const player = testObj[playerNumber];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
index 536482c962..7c321d33e3 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
@@ -28,7 +28,7 @@ Agora, quando acessamos `ourDog.bark`, nós teremos o seu latido, `bow-wow`.
Exemplo:
```js
-var ourDog = {
+const ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
@@ -67,7 +67,7 @@ assert(!/bark[^\n]:/.test(code));
## --seed-contents--
```js
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
@@ -80,7 +80,7 @@ var myDog = {
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
index 5b432e15a4..d9d0552b85 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
@@ -18,7 +18,7 @@ JavaScript utiliza o símbolo `+` como um operador de adição quando colocado e
**Exemplo:**
```js
-myVar = 5 + 10;
+const myVar = 5 + 10;
```
`myVar` agora tem o valor de `15`.
@@ -52,11 +52,11 @@ assert(/\+/.test(code));
## --seed-contents--
```js
-var sum = 10 + 0;
+const sum = 10 + 0;
```
# --solutions--
```js
-var sum = 10 + 10;
+const sum = 10 + 10;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
index cf93fe09a4..beffc0750b 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
@@ -92,7 +92,7 @@ assert(code.match(/break/g).length > 2);
```js
function switchOfStuff(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
@@ -108,7 +108,7 @@ switchOfStuff(1);
```js
function switchOfStuff(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case "a":
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
index 987a2387a1..06d6a5f57a 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
@@ -14,8 +14,8 @@ Assim como podemos construir uma string em várias linhas através das strings <
Exemplo:
```js
-var anAdjective = "awesome!";
-var ourStr = "freeCodeCamp is ";
+const anAdjective = "awesome!";
+let ourStr = "freeCodeCamp is ";
ourStr += anAdjective;
```
@@ -64,15 +64,14 @@ assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
```js
// Change code below this line
-
-var someAdjective;
-var myStr = "Learning to code is ";
+const someAdjective = "";
+let myStr = "Learning to code is ";
```
# --solutions--
```js
-var someAdjective = "neat";
-var myStr = "Learning to code is ";
+const someAdjective = "neat";
+let myStr = "Learning to code is ";
myStr += someAdjective;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
index fb9682c4d6..5032a5a25f 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
@@ -18,7 +18,7 @@ Objetos são úteis para armazenar dados de forma estruturada e podem representa
Aqui está um exemplo de objeto gato:
```js
-var cat = {
+const cat = {
"name": "Whiskers",
"legs": 4,
"tails": 1,
@@ -29,7 +29,7 @@ var cat = {
Neste exemplo, todas as propriedades são armazenadas como strings, como `name`, `legs` e `tails`. Porém, você também pode usar números como propriedades. Você pode até omitir as aspas para propriedades de string com uma única palavra, da seguinte forma:
```js
-var anotherObject = {
+const anotherObject = {
make: "Ford",
5: "five",
"model": "focus"
@@ -139,18 +139,18 @@ assert(
## --seed-contents--
```js
-var myDog = {
-// Only change code below this line
+const myDog = {
+ // Only change code below this line
-// Only change code above this line
+ // Only change code above this line
};
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
index 5dbedae385..94afde2001 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
@@ -16,7 +16,7 @@ O operador mais básico é o operador de igualdade `==`. O operador de igualdade
```js
function equalityTest(myVal) {
if (myVal == 10) {
- return "Equal";
+ return "Equal";
}
return "Not Equal";
}
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
index 2c13e190d2..efb651fb17 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
@@ -20,7 +20,7 @@ para adicionar `5` a `myVar`. Como este é um padrão tão comum, existem operad
Um desses operadores é o operador `+=`.
```js
-var myVar = 1;
+let myVar = 1;
myVar += 5;
console.log(myVar);
```
@@ -61,9 +61,9 @@ Você não deve modificar o código acima do comentário especificado.
```js
assert(
- /var a = 3;/.test(code) &&
- /var b = 17;/.test(code) &&
- /var c = 12;/.test(code)
+ /let a = 3;/.test(code) &&
+ /let b = 17;/.test(code) &&
+ /let c = 12;/.test(code)
);
```
@@ -78,9 +78,9 @@ assert(
## --seed-contents--
```js
-var a = 3;
-var b = 17;
-var c = 12;
+let a = 3;
+let b = 17;
+let c = 12;
// Only change code below this line
a = a + 12;
@@ -91,9 +91,9 @@ c = c + 7;
# --solutions--
```js
-var a = 3;
-var b = 17;
-var c = 12;
+let a = 3;
+let b = 17;
+let c = 12;
a += 12;
b += 9;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
index bb4335d4e6..79574ac77d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
@@ -55,9 +55,9 @@ Você não deve modificar o código acima do comentário especificado.
```js
assert(
- /var a = 48;/.test(code) &&
- /var b = 108;/.test(code) &&
- /var c = 33;/.test(code)
+ /let a = 48;/.test(code) &&
+ /let b = 108;/.test(code) &&
+ /let c = 33;/.test(code)
);
```
@@ -72,9 +72,9 @@ assert(
## --seed-contents--
```js
-var a = 48;
-var b = 108;
-var c = 33;
+let a = 48;
+let b = 108;
+let c = 33;
// Only change code below this line
a = a / 12;
@@ -85,9 +85,9 @@ c = c / 11;
# --solutions--
```js
-var a = 48;
-var b = 108;
-var c = 33;
+let a = 48;
+let b = 108;
+let c = 33;
a /= 12;
b /= 4;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
index 7b1f7ada71..9ab507cf2c 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
@@ -55,9 +55,9 @@ Você não deve modificar o código acima do comentário especificado.
```js
assert(
- /var a = 5;/.test(code) &&
- /var b = 12;/.test(code) &&
- /var c = 4\.6;/.test(code)
+ /let a = 5;/.test(code) &&
+ /let b = 12;/.test(code) &&
+ /let c = 4\.6;/.test(code)
);
```
@@ -72,9 +72,9 @@ assert(
## --seed-contents--
```js
-var a = 5;
-var b = 12;
-var c = 4.6;
+let a = 5;
+let b = 12;
+let c = 4.6;
// Only change code below this line
a = a * 5;
@@ -85,9 +85,9 @@ c = c * 10;
# --solutions--
```js
-var a = 5;
-var b = 12;
-var c = 4.6;
+let a = 5;
+let b = 12;
+let c = 4.6;
a *= 5;
b *= 3;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
index 627741cc1d..2dae4695cd 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
@@ -55,7 +55,7 @@ Você não deve modificar o código acima do comentário especificado.
```js
assert(
- /var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code)
+ /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code)
);
```
@@ -70,9 +70,9 @@ assert(
## --seed-contents--
```js
-var a = 11;
-var b = 9;
-var c = 3;
+let a = 11;
+let b = 9;
+let c = 3;
// Only change code below this line
a = a - 6;
@@ -83,9 +83,9 @@ c = c - 1;
# --solutions--
```js
-var a = 11;
-var b = 9;
-var c = 3;
+let a = 11;
+let b = 9;
+let c = 3;
a -= 6;
b -= 15;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
index 71904013f2..2c093f2f84 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
@@ -16,7 +16,7 @@ Também podemos usar o operador `+=` para concatenar uma string no fi
Exemplo:
```js
-var ourStr = "I come first. ";
+let ourStr = "I come first. ";
ourStr += "I come second.";
```
@@ -57,14 +57,12 @@ assert(code.match(/myStr\s*\+=\s*(["']).*\1/g));
## --seed-contents--
```js
-// Only change code below this line
-
-var myStr;
+let myStr;
```
# --solutions--
```js
-var myStr = "This is the first sentence. ";
+let myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
index 81f01b9312..82017bedc7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
@@ -14,8 +14,8 @@ dashedName: constructing-strings-with-variables
Exemplo:
```js
-var ourName = "freeCodeCamp";
-var ourStr = "Hello, our name is " + ourName + ", how are you?";
+const ourName = "freeCodeCamp";
+const ourStr = "Hello, our name is " + ourName + ", how are you?";
```
`ourStr` teria o valor da string `Hello, our name is freeCodeCamp, how are you?`.
@@ -63,13 +63,13 @@ assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
```js
// Only change code below this line
-var myName;
-var myStr;
+const myName = "";
+const myStr = "";
```
# --solutions--
```js
-var myName = "Bob";
-var myStr = "My name is " + myName + " and I am well!";
+const myName = "Bob";
+const myStr = "My name is " + myName + " and I am well!";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
index 0581beaa38..5e8fb5b8cd 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
@@ -159,7 +159,7 @@ assert(
## --seed-contents--
```js
-var count = 0;
+let count = 0;
function cc(card) {
// Only change code below this line
@@ -175,7 +175,7 @@ cc(2); cc(3); cc(7); cc('K'); cc('A');
# --solutions--
```js
-var count = 0;
+let count = 0;
function cc(card) {
switch(card) {
case 2:
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
index 748abf81d2..2690820cb7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
@@ -42,13 +42,14 @@ assert(myDecimal % 1 != 0);
## --seed-contents--
```js
-var ourDecimal = 5.7;
+const ourDecimal = 5.7;
// Only change code below this line
+
```
# --solutions--
```js
-var myDecimal = 9.9;
+const myDecimal = 9.9;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
index 29a3d15026..bed512835e 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
@@ -39,7 +39,7 @@ assert(myVar === 10);
```js
assert(
- /var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
+ /let\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
);
```
@@ -52,7 +52,7 @@ assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
Você não deve alterar o código acima do comentário especificado.
```js
-assert(/var myVar = 11;/.test(code));
+assert(/let myVar = 11;/.test(code));
```
# --seed--
@@ -66,7 +66,7 @@ assert(/var myVar = 11;/.test(code));
## --seed-contents--
```js
-var myVar = 11;
+let myVar = 11;
// Only change code below this line
myVar = myVar - 1;
@@ -75,6 +75,6 @@ myVar = myVar - 1;
# --solutions--
```js
-var myVar = 11;
+let myVar = 11;
myVar--;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
index 45199937e1..0934dfc758 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
@@ -18,7 +18,7 @@ delete ourDog.bark;
Exemplo:
```js
-var ourDog = {
+const ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
@@ -70,7 +70,7 @@ assert(code.match(/"tails": 1/g).length > 0);
```js
// Setup
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
@@ -79,12 +79,13 @@ var myDog = {
};
// Only change code below this line
+
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
index f08b9f39fe..67117d004f 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
@@ -46,11 +46,11 @@ assert(code.match(/quotient/g).length === 1);
## --seed-contents--
```js
-var quotient = 0.0 / 2.0; // Change this line
+const quotient = 0.0 / 2.0; // Change this line
```
# --solutions--
```js
-var quotient = 4.4 / 2.0;
+const quotient = 4.4 / 2.0;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
index 2cc5327032..0fe66dbf7d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript usa o símbolo `/` para divisão.
**Exemplo**
```js
-myVar = 16 / 2;
+const myVar = 16 / 2;
```
`myVar` agora possui o valor `8`.
@@ -49,11 +49,11 @@ assert(/\d+\s*\/\s*\d+/.test(code));
## --seed-contents--
```js
-var quotient = 66 / 0;
+const quotient = 66 / 0;
```
# --solutions--
```js
-var quotient = 66 / 33;
+const quotient = 66 / 33;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
index c468fc1741..f808b75cb7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
@@ -89,11 +89,11 @@ console.log('myStr:\n' + myStr);}})();
## --seed-contents--
```js
-var myStr; // Change this line
+const myStr = ""; // Change this line
```
# --solutions--
```js
-var myStr = "FirstLine\n\t\\SecondLine\nThirdLine";
+const myStr = "FirstLine\n\t\\SecondLine\nThirdLine";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
index 5558498f3e..f309410528 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
@@ -14,7 +14,7 @@ Quando você estiver definindo uma sequência de caracteres você deve iniciar e
Em JavaScript, você pode escapar uma aspa para que não seja considerada como o fim de uma string ao colocar a barra invertida (`\`) na frente da aspa.
```js
-var sampleStr = "Alan said, \"Peter is learning JavaScript\".";
+const sampleStr = "Alan said, \"Peter is learning JavaScript\".";
```
Isso sinaliza ao JavaScript que a aspa seguinte não é o fim de uma string, mas que deve aparecer dentro da string. Então, se você fosse imprimir isso no console, você obteria:
@@ -62,11 +62,11 @@ assert(/I am a "double quoted" string inside "double quotes(\."|"\.)$/.test(mySt
## --seed-contents--
```js
-var myStr = ""; // Change this line
+const myStr = ""; // Change this line
```
# --solutions--
```js
-var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
+const myStr = "I am a \"double quoted\" string inside \"double quotes\".";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
index e58e42c022..987b99767a 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
@@ -31,7 +31,7 @@ Define o `resto` igual ao restante de `11` dividido por `3` usando o operador de
A variável `remainder` deve ser inicializada
```js
-assert(/var\s+?remainder/.test(code));
+assert(/(const|let|var)\s+?remainder/.test(code));
```
O valor de `remainder` deve ser `2`
@@ -57,13 +57,11 @@ assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
## --seed-contents--
```js
-// Only change code below this line
-
-var remainder;
+const remainder = 0;
```
# --solutions--
```js
-var remainder = 11 % 3;
+const remainder = 11 % 3;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
index 5da50dd0d2..d1a03237e6 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
@@ -14,9 +14,10 @@ dashedName: global-vs--local-scope-in-functions
Neste exemplo:
```js
-var someVar = "Hat";
+const someVar = "Hat";
+
function myFun() {
- var someVar = "Head";
+ const someVar = "Head";
return someVar;
}
```
@@ -53,13 +54,11 @@ assert(/return outerWear/.test(code));
```js
// Setup
-var outerWear = "T-Shirt";
+const outerWear = "T-Shirt";
function myOutfit() {
// Only change code below this line
-
-
// Only change code above this line
return outerWear;
}
@@ -70,9 +69,9 @@ myOutfit();
# --solutions--
```js
-var outerWear = "T-Shirt";
+const outerWear = "T-Shirt";
function myOutfit() {
- var outerWear = "sweater";
+ const outerWear = "sweater";
return outerWear;
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
index 28bd619a55..bc401dc1d7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
@@ -90,7 +90,8 @@ assert(golfScore(5, 9) === 'Go Home!');
## --seed-contents--
```js
-var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
+const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
+
function golfScore(par, strokes) {
// Only change code below this line
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
index 21aa67e670..16b4f4f56f 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
@@ -39,7 +39,7 @@ Você não deve usar o operador de atribuição.
```js
assert(
- /var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code)
+ /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code)
);
```
@@ -52,7 +52,7 @@ assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
Você não deve alterar o código acima do comentário especificado.
```js
-assert(/var myVar = 87;/.test(code));
+assert(/let myVar = 87;/.test(code));
```
# --seed--
@@ -66,7 +66,7 @@ assert(/var myVar = 87;/.test(code));
## --seed-contents--
```js
-var myVar = 87;
+let myVar = 87;
// Only change code below this line
myVar = myVar + 1;
@@ -75,6 +75,6 @@ myVar = myVar + 1;
# --solutions--
```js
-var myVar = 87;
+let myVar = 87;
myVar++;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
index 7d59459468..874d3ed9a3 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
@@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5');
Você não deve alterar o código acima ou abaixo dos comentários especificados.
```js
-assert(/var result = "";/.test(code) && /return result;/.test(code));
+assert(/let result = "";/.test(code) && /return result;/.test(code));
```
# --seed--
@@ -73,7 +73,7 @@ assert(/var result = "";/.test(code) && /return result;/.test(code));
```js
function testElse(val) {
- var result = "";
+ let result = "";
// Only change code below this line
if (val > 5) {
@@ -95,7 +95,7 @@ testElse(4);
```js
function testElse(val) {
- var result = "";
+ let result = "";
if(val > 5) {
result = "Bigger than 5";
} else {
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
index a0d8ab56a2..4860c8cfde 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
@@ -12,8 +12,9 @@ dashedName: iterate-through-an-array-with-a-for-loop
Uma tarefa comum em JavaScript é para iterar através do conteúdo de um array. Uma forma de fazer isso é com um laço `for`. Esse código vai exibir cada elemento do array `arr` no console:
```js
-var arr = [10, 9, 8, 7, 6];
-for (var i = 0; i < arr.length; i++) {
+const arr = [10, 9, 8, 7, 6];
+
+for (let i = 0; i < arr.length; i++) {
console.log(arr[i]);
}
```
@@ -62,18 +63,19 @@ assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
```js
// Setup
-var myArr = [ 2, 3, 4, 5, 6];
+const myArr = [2, 3, 4, 5, 6];
// Only change code below this line
+
```
# --solutions--
```js
-var myArr = [ 2, 3, 4, 5, 6];
-var total = 0;
+const myArr = [2, 3, 4, 5, 6];
+let total = 0;
-for (var i = 0; i < myArr.length; i++) {
+for (let i = 0; i < myArr.length; i++) {
total += myArr[i];
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
index a83f89c0b0..d1d0271330 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
@@ -12,8 +12,9 @@ dashedName: iterate-with-javascript-do---while-loops
O próximo tipo de laço que você aprenderá é chamado de laço `do...while`. O laço `do...while` é chamado assim porque primeiro fará algo (`do`) ou executará algo uma vez dentro do bloco de código, não importando o que acontecer. Em seguida, continuará a executar o laço enquanto (`while`) a condição for `true`.
```js
-var ourArray = [];
-var i = 0;
+const ourArray = [];
+let i = 0;
+
do {
ourArray.push(i);
i++;
@@ -23,8 +24,9 @@ do {
O exemplo acima se comporta de forma similar a outros tipos de laços, e o array resultante se parecerá com `[0,1,2,3,4]`. No entanto, o que torna o laço `do...while` diferente de outros laços é como ele se comporta quando uma condição falha na primeira verificação. Vamos ver isso na prática: Aqui está um laço comum `while` que rodará o código no laço enquanto `i < 5`:
```js
-var ourArray = [];
-var i = 5;
+const ourArray = [];
+let i = 5;
+
while (i < 5) {
ourArray.push(i);
i++;
@@ -34,8 +36,9 @@ while (i < 5) {
Nesse exemplo, inicializamos o valor de `ourArray` como um array vazio e o valor de `i` sendo 5. Quando executamos o laço `while`, a condição é igual a `false` porque `i` não é menor que 5, portanto nós não executamos o código dentro do laço. O resultado é que `ourArray` terminará sem valores adicionados a ele, e ainda se parecerá com `[]` quando todas as linhas do código no exemplo acima forem completamente executadas. Agora, dê uma olhada no laço `do...while`:
```js
-var ourArray = [];
-var i = 5;
+const ourArray = [];
+let i = 5;
+
do {
ourArray.push(i);
i++;
@@ -80,8 +83,8 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Setup
-var myArray = [];
-var i = 10;
+const myArray = [];
+let i = 10;
// Only change code below this line
while (i < 5) {
@@ -93,8 +96,8 @@ while (i < 5) {
# --solutions--
```js
-var myArray = [];
-var i = 10;
+const myArray = [];
+let i = 10;
do {
myArray.push(i);
i++;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
index 503ff92833..3b55efd09c 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
@@ -15,9 +15,10 @@ Aqui está uma função `myTest` com uma variável local chamada `loc`.
```js
function myTest() {
- var loc = "foo";
+ const loc = "foo";
console.log(loc);
}
+
myTest();
console.log(loc);
```
@@ -38,6 +39,7 @@ O código não deve conter uma variável global `myVar`.
function declared() {
myVar;
}
+
assert.throws(declared, ReferenceError);
```
@@ -57,7 +59,6 @@ assert(
```js
function myLocalScope() {
-
// Only change code below this line
console.log('inside myLocalScope', myVar);
@@ -73,9 +74,8 @@ console.log('outside myLocalScope', myVar);
```js
function myLocalScope() {
-
// Only change code below this line
- var myVar;
+ let myVar;
console.log('inside myLocalScope', myVar);
}
myLocalScope();
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
index 3f21578117..8db979418e 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
@@ -16,10 +16,10 @@ Uma forma fácil de adicionar dados no final de um array é através da função
Exemplos:
```js
-var arr1 = [1,2,3];
+const arr1 = [1, 2, 3];
arr1.push(4);
-var arr2 = ["Stimpson", "J", "cat"];
+const arr2 = ["Stimpson", "J", "cat"];
arr2.push(["happy", "joy"]);
```
@@ -64,14 +64,15 @@ assert(
```js
// Setup
-var myArray = [["John", 23], ["cat", 2]];
+const myArray = [["John", 23], ["cat", 2]];
// Only change code below this line
+
```
# --solutions--
```js
-var myArray = [["John", 23], ["cat", 2]];
+const myArray = [["John", 23], ["cat", 2]];
myArray.push(["dog",3]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
index 592972f211..3c7f958fc4 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
@@ -14,7 +14,7 @@ dashedName: manipulating-complex-objects
Aqui está um exemplo de estrutura de dados complexas:
```js
-var ourMusic = [
+const ourMusic = [
{
"artist": "Daft Punk",
"title": "Homework",
@@ -135,7 +135,7 @@ myMusic.forEach(object => {
## --seed-contents--
```js
-var myMusic = [
+const myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
@@ -153,7 +153,7 @@ var myMusic = [
# --solutions--
```js
-var myMusic = [
+const myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
index 2d725d17f7..b36c8a09da 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
@@ -12,7 +12,7 @@ dashedName: multiple-identical-options-in-switch-statements
Se a instrução `break` for omitida de uma instrução `case` de um `switch`, as instruções `case` seguintes serão executadas até que seja encontrado um `break`. Se você tem várias entradas com a mesma saída, você pode representá-las em uma instrução `switch` da seguinte forma:
```js
-var result = "";
+let result = "";
switch(val) {
case 1:
case 2:
@@ -109,7 +109,7 @@ assert(code.match(/case/g).length === 9);
```js
function sequentialSizes(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
@@ -125,7 +125,7 @@ sequentialSizes(1);
```js
function sequentialSizes(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case 1:
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
index 6c77e1e2a0..168604e8d1 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
@@ -42,11 +42,11 @@ assert(/\*/.test(code));
## --seed-contents--
```js
-var product = 2.0 * 0.0;
+const product = 2.0 * 0.0;
```
# --solutions--
```js
-var product = 2.0 * 2.5;
+const product = 2.0 * 2.5;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
index f4c7329ff0..1260f4b802 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript usa o símbolo `*` para multiplicação de dois números.
**Exemplo**
```js
-myVar = 13 * 13;
+const myVar = 13 * 13;
```
`myVar` teria o valor `169`.
@@ -50,11 +50,11 @@ assert(/\*/.test(code));
## --seed-contents--
```js
-var product = 8 * 0;
+const product = 8 * 0;
```
# --solutions--
```js
-var product = 8 * 10;
+const product = 8 * 10;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
index 1d70732ef8..19d0687fe9 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
@@ -12,7 +12,7 @@ dashedName: nest-one-array-within-another-array
Você também pode aninhar arrays dentro de outros arrays, como abaixo:
```js
-[["Bulls", 23], ["White Sox", 45]]
+const teams = [["Bulls", 23], ["White Sox", 45]];
```
Isso é chamado um array multidimensional.
@@ -41,11 +41,11 @@ if(typeof myArray !== "undefined"){(function(){return myArray;})();}
```js
// Only change code below this line
-var myArray = [];
+const myArray = [];
```
# --solutions--
```js
-var myArray = [[1,2,3]];
+const myArray = [[1, 2, 3]];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
index 61b354601b..dab980a96c 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
@@ -68,34 +68,33 @@ assert(lookUpProfile('Akira', 'address') === 'No such property');
```js
// Setup
-var contacts = [
- {
- "firstName": "Akira",
- "lastName": "Laine",
- "number": "0543236543",
- "likes": ["Pizza", "Coding", "Brownie Points"]
- },
- {
- "firstName": "Harry",
- "lastName": "Potter",
- "number": "0994372684",
- "likes": ["Hogwarts", "Magic", "Hagrid"]
- },
- {
- "firstName": "Sherlock",
- "lastName": "Holmes",
- "number": "0487345643",
- "likes": ["Intriguing Cases", "Violin"]
- },
- {
- "firstName": "Kristian",
- "lastName": "Vos",
- "number": "unknown",
- "likes": ["JavaScript", "Gaming", "Foxes"]
- }
+const contacts = [
+ {
+ firstName: "Akira",
+ lastName: "Laine",
+ number: "0543236543",
+ likes: ["Pizza", "Coding", "Brownie Points"],
+ },
+ {
+ firstName: "Harry",
+ lastName: "Potter",
+ number: "0994372684",
+ likes: ["Hogwarts", "Magic", "Hagrid"],
+ },
+ {
+ firstName: "Sherlock",
+ lastName: "Holmes",
+ number: "0487345643",
+ likes: ["Intriguing Cases", "Violin"],
+ },
+ {
+ firstName: "Kristian",
+ lastName: "Vos",
+ number: "unknown",
+ likes: ["JavaScript", "Gaming", "Foxes"],
+ },
];
-
function lookUpProfile(name, prop) {
// Only change code below this line
@@ -108,44 +107,38 @@ lookUpProfile("Akira", "likes");
# --solutions--
```js
-var contacts = [
- {
- "firstName": "Akira",
- "lastName": "Laine",
- "number": "0543236543",
- "likes": ["Pizza", "Coding", "Brownie Points"]
- },
- {
- "firstName": "Harry",
- "lastName": "Potter",
- "number": "0994372684",
- "likes": ["Hogwarts", "Magic", "Hagrid"]
- },
- {
- "firstName": "Sherlock",
- "lastName": "Holmes",
- "number": "0487345643",
- "likes": ["Intriguing Cases", "Violin"]
- },
- {
- "firstName": "Kristian",
- "lastName": "Vos",
- "number": "unknown",
- "likes": ["JavaScript", "Gaming", "Foxes"]
- },
+const contacts = [
+ {
+ firstName: "Akira",
+ lastName: "Laine",
+ number: "0543236543",
+ likes: ["Pizza", "Coding", "Brownie Points"],
+ },
+ {
+ firstName: "Harry",
+ lastName: "Potter",
+ number: "0994372684",
+ likes: ["Hogwarts", "Magic", "Hagrid"],
+ },
+ {
+ firstName: "Sherlock",
+ lastName: "Holmes",
+ number: "0487345643",
+ likes: ["Intriguing Cases", "Violin"],
+ },
+ {
+ firstName: "Kristian",
+ lastName: "Vos",
+ number: "unknown",
+ likes: ["JavaScript", "Gaming", "Foxes"],
+ },
];
-
-
-//Write your function in between these comments
-function lookUpProfile(name, prop){
- for(var i in contacts){
- if(contacts[i].firstName === name) {
- return contacts[i][prop] || "No such property";
- }
+function lookUpProfile(name, prop) {
+ for (let i in contacts) {
+ if (contacts[i].firstName === name) {
+ return contacts[i][prop] || "No such property";
}
- return "No such contact";
+ }
+ return "No such contact";
}
-//Write your function in between these comments
-
-lookUpProfile("Akira", "likes");
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
index 872ea6e039..cbe779ce0b 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
@@ -12,21 +12,21 @@ dashedName: quoting-strings-with-single-quotes
Valores de string em JavaScript podem ser escritas com aspas simples ou duplas, desde que você comece e termine com o mesmo tipo de aspas. Diferente de outras linguagens de programação, aspas simples e duplas funcionam da mesma forma em JavaScript.
```js
-doubleQuoteStr = "This is a string";
-singleQuoteStr = 'This is also a string';
+const doubleQuoteStr = "This is a string";
+const singleQuoteStr = 'This is also a string';
```
O motivo pelo qual você pode querer usar um tipo de aspas no lugar da outra é se você vir a querer usar ambas em uma string. Isso pode acontecer se você quiser salvar uma conversa em uma string e ter a conversa entre aspas. Outro uso para isso seria salvar uma tag `` com vários atributos em aspas, tudo dentro de uma string.
```js
-conversation = 'Finn exclaims to Jake, "Algebraic!"';
+const conversation = 'Finn exclaims to Jake, "Algebraic!"';
```
Porém, isso se torna um problema se você precisar usar as aspas mais extremas dentro dela. Lembre-se, uma string tem o mesmo tipo de aspas no início e no final. Mas se você tem aquela mesma aspa em algum lugar no meio, a string vai terminar mais cedo e lançará um erro.
```js
-goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
-badStr = 'Finn responds, "Let's go!"';
+const goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
+const badStr = 'Finn responds, "Let's go!"';
```
Aqui `badStr` lançará um erro.
@@ -71,11 +71,11 @@ assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
## --seed-contents--
```js
-var myStr = "Link";
+const myStr = "Link";
```
# --solutions--
```js
-var myStr = 'Link';
+const myStr = 'Link';
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
index 256e6325f7..bec11f1f66 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
@@ -115,7 +115,7 @@ const _recordCollection = {
```js
// Setup
-var recordCollection = {
+const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
@@ -146,7 +146,7 @@ updateRecords(recordCollection, 5439, 'artist', 'ABBA');
# --solutions--
```js
-var recordCollection = {
+const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
index 4dfb3c5a33..c15779f5e0 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
@@ -14,9 +14,9 @@ Recursão é o conceito de que uma função pode ser chamada por ela mesma. Para
```js
function multiply(arr, n) {
- var product = 1;
- for (var i = 0; i < n; i++) {
- product *= arr[i];
+ let product = 1;
+ for (let i = 0; i < n; i++) {
+ product *= arr[i];
}
return product;
}
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
index 3d3f58f14e..c08b94c7c6 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
@@ -108,7 +108,7 @@ assert(chainToSwitch(156) === '');
```js
function chainToSwitch(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
if (val === "bob") {
@@ -134,7 +134,7 @@ chainToSwitch(7);
```js
function chainToSwitch(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case "bob":
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
index 6015e33980..b084ca43d8 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
@@ -17,7 +17,8 @@ Nós podemos passar valores para uma função com argumentos. Você p
function plusThree(num) {
return num + 3;
}
-var answer = plusThree(5);
+
+const answer = plusThree(5);
```
`answer` tem o valor de `8`.
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
index 13e07afff8..82c837dbda 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
@@ -78,7 +78,7 @@ assert(code.match(/break/g).length > 2);
```js
function caseInSwitch(val) {
- var answer = "";
+ let answer = "";
// Only change code below this line
@@ -94,7 +94,7 @@ caseInSwitch(1);
```js
function caseInSwitch(val) {
- var answer = "";
+ let answer = "";
switch(val) {
case 1:
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
index 9c108ac14d..9b7bfd86ef 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
@@ -81,13 +81,13 @@ var hasNumber = false;
## --seed-contents--
```js
-var myList = [];
+const myList = [];
```
# --solutions--
```js
-var myList = [
+const myList = [
["Candy", 10],
["Potatoes", 12],
["Eggs", 12],
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
index ff6f79a9c7..ed2c450625 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
@@ -93,12 +93,10 @@ function nextInLine(arr, item) {
return item;
// Only change code above this line
-
-
}
// Setup
-var testArr = [1,2,3,4,5];
+const testArr = [1, 2, 3, 4, 5];
// Display code
console.log("Before: " + JSON.stringify(testArr));
@@ -109,7 +107,7 @@ console.log("After: " + JSON.stringify(testArr));
# --solutions--
```js
-var testArr = [ 1,2,3,4,5];
+const testArr = [1, 2, 3, 4, 5];
function nextInLine(arr, item) {
arr.push(item);
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
index 079b028a3e..07196097e6 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
@@ -14,7 +14,7 @@ Com as variáveis de `array` em JavaScript, podemos armazenar diversos dados em
Você começa uma declaração de um array com a abertura de um colchetes, terminando com o fechamento do colchetes e colocando vírgulas entre cada entrada, dessa forma:
```js
-var sandwich = ["peanut butter", "jelly", "bread"]
+const sandwich = ["peanut butter", "jelly", "bread"];
```
# --instructions--
@@ -53,11 +53,11 @@ assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
```js
// Only change code below this line
-var myArray = [];
+const myArray = [];
```
# --solutions--
```js
-var myArray = ["The Answer", 42];
+const myArray = ["The Answer", 42];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
index 763f26cb6c..3310676788 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
@@ -16,7 +16,7 @@ JavaScript usa o símbolo `-` para subtração.
**Exemplo**
```js
-myVar = 12 - 6;
+const myVar = 12 - 6;
```
`myVar` teria o valor `6`.
@@ -49,11 +49,11 @@ assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));
## --seed-contents--
```js
-var difference = 45 - 0;
+const difference = 45 - 0;
```
# --solutions--
```js
-var difference = 45 - 33;
+const difference = 45 - 33;
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 27ed80eec0..2c8af2b05e 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -13,10 +13,11 @@ dashedName: testing-objects-for-properties
**Exemplo**
```js
-var myObj = {
+const myObj = {
top: "hat",
bottom: "pants"
};
+
myObj.hasOwnProperty("top");
myObj.hasOwnProperty("middle");
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
index 58b01d3748..0ad2fe93dc 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
@@ -14,14 +14,14 @@ Em JavaScript, valores `String` são imutáveis, o que significa que
Por exemplo, o código a seguir:
```js
-var myStr = "Bob";
+let myStr = "Bob";
myStr[0] = "J";
```
não permite alterar o valor de `myStr` para `Job`, porque o conteúdo de `myStr` não pode ser alterado. Note que isso *não* significa que `myStr` não pode ser alterado, apenas que os caracteres individuais de uma string literal não podem ser alterados. A única forma de alterar `myStr` seria atribuindo a ela uma nova string, dessa forma:
```js
-var myStr = "Bob";
+let myStr = "Bob";
myStr = "Job";
```
@@ -55,7 +55,7 @@ assert(/myStr = "Jello World"/.test(code));
```js
// Setup
-var myStr = "Jello World";
+let myStr = "Jello World";
// Only change code below this line
myStr[0] = "H"; // Change this line
@@ -65,6 +65,6 @@ myStr[0] = "H"; // Change this line
# --solutions--
```js
-var myStr = "Jello World";
+let myStr = "Jello World";
myStr = "Hello World";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
index d1240f035f..0d45f0d6a3 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
@@ -43,7 +43,6 @@ welcomeToBooleans();
```js
function welcomeToBooleans() {
-
// Only change code below this line
return false; // Change this line
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
index 5c0ee20a1b..3230b281fe 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
@@ -14,10 +14,12 @@ Uma função pode incluir a instrução `return` mas ela não precisa fazer isso
**Exemplo**
```js
-var sum = 0;
+let sum = 0;
+
function addSum(num) {
sum = sum + num;
}
+
addSum(3);
```
@@ -61,7 +63,7 @@ assert(
```js
// Setup
-var sum = 0;
+let sum = 0;
function addThree() {
sum = sum + 3;
@@ -79,7 +81,7 @@ addFive();
# --solutions--
```js
-var sum = 0;
+let sum = 0;
function addThree() {
sum = sum + 3;
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
index fcf5f4f160..27e558a6bf 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
@@ -14,7 +14,7 @@ Depois de criar um objeto JavaScript, você pode atualizar suas propriedades a q
Por exemplo, vamos dar uma olhada em `ourDog`:
```js
-var ourDog = {
+const ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
@@ -54,7 +54,7 @@ assert(/"name": "Coder"/.test(code));
```js
// Setup
-var myDog = {
+const myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
@@ -62,12 +62,13 @@ var myDog = {
};
// Only change code below this line
+
```
# --solutions--
```js
-var myDog = {
+const myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
index 49ac129577..5b7d55bc90 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
@@ -16,8 +16,8 @@ Lembre-se de que computadores começam contando do `0`. Então, o primeiro carac
Exemplo:
```js
-var firstName = "Ada";
-var secondLetterOfFirstName = firstName[1];
+const firstName = "Ada";
+const secondLetterOfFirstName = firstName[1];
```
`secondLetterOfFirstName` teria o valor da string `d`.
@@ -54,15 +54,15 @@ assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```js
// Setup
-var lastName = "Lovelace";
+const lastName = "Lovelace";
// Only change code below this line
-var thirdLetterOfLastName = lastName; // Change this line
+const thirdLetterOfLastName = lastName; // Change this line
```
# --solutions--
```js
-var lastName = "Lovelace";
-var thirdLetterOfLastName = lastName[2];
+const lastName = "Lovelace";
+const thirdLetterOfLastName = lastName[2];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
index 8d4f0948e2..bea00af748 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
@@ -73,7 +73,7 @@ function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
- var numbers = rangeOfNumbers(startNum, endNum - 1);
+ const numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
index 81bd81106a..0ff735c10d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
@@ -20,7 +20,7 @@ parseInt(string, radix);
Exemplo:
```js
-var a = parseInt("11", 2);
+const a = parseInt("11", 2);
```
A variável radix diz que `11` está no sistema binário, ou base 2. Esse exemplo converte a string `11` para um inteiro `3`.
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
index a48ab98937..6cad3010f5 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
@@ -12,7 +12,7 @@ dashedName: use-the-parseint-function
A função `parseInt()` analisa uma string e retorna um inteiro. Exemplo:
```js
-var a = parseInt("007");
+const a = parseInt("007");
```
A função acima converte a string `007` para o inteiro `7`. Se o primeiro caractere na string não pode ser convertido em um número, então ele retorna `NaN`.
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
index 6137d6f528..973e9af6f3 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
@@ -14,7 +14,7 @@ Objetos podem ser pensados como armazenamento de chave/valor, como um dicionári
Aqui está um exemplo de uma simples pesquisa reversa no alfabeto:
```js
-var alpha = {
+const alpha = {
1:"Z",
2:"Y",
3:"X",
@@ -24,10 +24,11 @@ var alpha = {
25:"B",
26:"A"
};
+
alpha[2];
alpha[24];
-var value = 2;
+const value = 2;
alpha[value];
```
@@ -102,7 +103,7 @@ assert(
```js
// Setup
function phoneticLookup(val) {
- var result = "";
+ let result = "";
// Only change code below this line
switch(val) {
@@ -136,9 +137,9 @@ phoneticLookup("charlie");
```js
function phoneticLookup(val) {
- var result = "";
+ let result = "";
- var lookup = {
+ const lookup = {
alpha: "Adams",
bravo: "Boston",
charlie: "Chicago",
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
index 19f327e8af..4b28d911f6 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
@@ -16,7 +16,7 @@ Em um jogo de "Mad Libs", você recebe frases com algumas palavras faltando, com
Considere a frase - Era realmente **\_\_\_\_** e nós **\_\_\_\_** nós mesmos **\_\_\_\_**. Essa frase possui três pedaços faltando - um adjetivo, um verbo e um advérbio, e nós podemos adicionar palavras de nossa escolha para completar. Em seguida, podemos atribuir a frase completa para uma variável como se segue:
```js
-var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
+const sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
```
# --instructions--
@@ -84,24 +84,24 @@ const removeAssignments = str => str
## --seed-contents--
```js
-var myNoun = "dog";
-var myAdjective = "big";
-var myVerb = "ran";
-var myAdverb = "quickly";
+const myNoun = "dog";
+const myAdjective = "big";
+const myVerb = "ran";
+const myAdverb = "quickly";
// Only change code below this line
-var wordBlanks = ""; // Change this line
+const wordBlanks = ""; // Change this line
// Only change code above this line
```
# --solutions--
```js
-var myNoun = "dog";
-var myAdjective = "big";
-var myVerb = "ran";
-var myAdverb = "quickly";
+const myNoun = "dog";
+const myAdjective = "big";
+const myVerb = "ran";
+const myAdverb = "quickly";
-var wordBlanks = "Once there was a " + myNoun + " which was very " + myAdjective + ". ";
+let wordBlanks = "Once there was a " + myNoun + " which was very " + myAdjective + ". ";
wordBlanks += "It " + myVerb + " " + myAdverb + " around the yard.";
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
index 74ca32bb5a..3cab970012 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
@@ -13,7 +13,7 @@ Programação funcional é basicamente criar e utilizar funções que não modif
O último desafio mostrou como usar o método `concat` para criar um novo array a partir da combinação de outros sem modificar os originais. Compare os métodos `concat` e `push`. O `push` adiciona um item ao final do array à esquerda do `.`. Ele modifica o array. Exemplo:
```js
-var arr = [1, 2, 3];
+const arr = [1, 2, 3];
arr.push([4, 5, 6]);
```
@@ -71,8 +71,9 @@ function nonMutatingPush(original, newItem) {
// Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
+
+const first = [1, 2, 3];
+const second = [4, 5];
nonMutatingPush(first, second);
```
@@ -82,7 +83,6 @@ nonMutatingPush(first, second);
function nonMutatingPush(original, newItem) {
return original.concat(newItem);
}
-var first = [1, 2, 3];
-var second = [4, 5];
-nonMutatingPush(first, second);
+const first = [1, 2, 3];
+const second = [4, 5];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
index 95d7bb6c98..83daf61613 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
@@ -77,7 +77,6 @@ function urlSlug(title) {
# --solutions--
```js
-// Only change code below this line
function urlSlug(title) {
return title.trim().split(/\s+/).join("-").toLowerCase();
}
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
index c7cef37d22..91fa537088 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
@@ -57,9 +57,9 @@ A função `incrementer` deve retornar um valor baseado no valor da variável gl
```js
// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
-function incrementer () {
+function incrementer() {
// Only change code below this line
@@ -70,7 +70,7 @@ function incrementer () {
# --solutions--
```js
-var fixedValue = 4
+let fixedValue = 4
function incrementer() {
return fixedValue + 1
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
index a0f7825272..d44460fcff 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
@@ -13,8 +13,8 @@ O método `join` é usado para juntar os elementos de um array, resultando em um
Exemplo:
```js
-var arr = ["Hello", "World"];
-var str = arr.join(" ");
+const arr = ["Hello", "World"];
+const str = arr.join(" ");
```
O valor de `str` é `Hello World`.
@@ -76,6 +76,7 @@ function sentensify(str) {
// Only change code above this line
}
+
sentensify("May-the-force-be-with-you");
```
@@ -83,8 +84,6 @@ sentensify("May-the-force-be-with-you");
```js
function sentensify(str) {
- // Only change code below this line
return str.split(/\W/).join(' ');
- // Only change code above this line
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
index 5f2e3f0ec3..fe25f4f3fd 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
@@ -60,8 +60,9 @@ function nonMutatingConcat(original, attach) {
// Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
+
+const first = [1, 2, 3];
+const second = [4, 5];
nonMutatingConcat(first, second);
```
@@ -69,11 +70,8 @@ nonMutatingConcat(first, second);
```js
function nonMutatingConcat(original, attach) {
- // Only change code below this line
return original.concat(attach);
- // Only change code above this line
}
-var first = [1, 2, 3];
-var second = [4, 5];
-nonMutatingConcat(first, second);
+const first = [1, 2, 3];
+const second = [4, 5];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
index 9b054777b8..4bfd307fff 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
@@ -38,17 +38,17 @@ assert(!code.match(/\.?[\s\S]*?map/g));
```js
// The global variable
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myMap = function(callback) {
- var newArray = [];
+ const newArray = [];
// Only change code below this line
// Only change code above this line
return newArray;
};
-var new_s = s.myMap(function(item) {
+const new_s = s.myMap(function(item) {
return item * 2;
});
```
@@ -56,20 +56,17 @@ var new_s = s.myMap(function(item) {
# --solutions--
```js
-// the global Array
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myMap = function(callback) {
- var newArray = [];
- // Only change code below this line
- for (var elem of this) {
+ const newArray = [];
+ for (const elem of this) {
newArray.push(callback(elem));
}
- // Only change code above this line
return newArray;
};
-var new_s = s.myMap(function(item) {
+const new_s = s.myMap(function(item) {
return item * 2;
});
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
index 5936d42877..96fa45b4f6 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
@@ -34,16 +34,16 @@ assert(!code.match(/\.?[\s\S]*?filter/g));
```js
// The global variable
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback) {
// Only change code below this line
- var newArray = [];
+ const newArray = [];
// Only change code above this line
return newArray;
};
-var new_s = s.myFilter(function(item) {
+const new_s = s.myFilter(function(item) {
return item % 2 === 1;
});
```
@@ -51,20 +51,17 @@ var new_s = s.myFilter(function(item) {
# --solutions--
```js
-// the global Array
-var s = [23, 65, 98, 5];
+const s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback) {
- var newArray = [];
- // Only change code below this line
+ const newArray = [];
for (let i = 0; i < this.length; i++) {
if (callback(this[i])) newArray.push(this[i]);
}
- // Only change code above this line
return newArray;
};
-var new_s = s.myFilter(function(item) {
+const new_s = s.myFilter(function(item) {
return item % 2 === 1;
});
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
index f395576c8f..26826046c7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
@@ -35,7 +35,7 @@ curried(1)(2)
Isso é útil em seu programa quando você não pode fornecer todos os argumentos para uma função de uma só vez. Você pode salvar cada chamada de função em uma variável, que será uma referência à função retornada que recebe o próximo argumento quando ele estiver disponível. Um exemplo usando a função do exemplo acima:
```js
-var funcForY = curried(1);
+const funcForY = curried(1);
console.log(funcForY(2)); // 3
```
@@ -45,7 +45,8 @@ Da mesma forma, aplicação parcial pode ser descrita como a aplicaç
function impartial(x, y, z) {
return x + y + z;
}
-var partialFn = impartial.bind(this, 1, 2);
+
+const partialFn = impartial.bind(this, 1, 2);
partialFn(10); // 13
```
@@ -90,6 +91,7 @@ function add(x) {
// Only change code above this line
}
+
add(10)(20)(30);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
index 8ff1c00492..573bc8acb0 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
@@ -53,10 +53,10 @@ assert(__newValue === 5);
```js
// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
// Only change code below this line
-function incrementer () {
+function incrementer() {
// Only change code above this line
@@ -66,15 +66,9 @@ function incrementer () {
# --solutions--
```js
-// The global variable
-var fixedValue = 4;
+let fixedValue = 4;
-// Only change code below this line
-function incrementer (fixedValue) {
+function incrementer(fixedValue) {
return fixedValue + 1;
-
- // Only change code above this line
}
-
-
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
index add3158900..54d0a2f3e4 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
@@ -11,7 +11,7 @@ dashedName: remove-elements-from-an-array-using-slice-instead-of-splice
É comum precisar remover alguns itens de um array e manter o resto. O JavaScript oferece o método `splice`, que recebe uma posição de onde começar a remover e o número de elementos para remover como argumentos para isso. Se o segundo argumento for omitido, o padrão é remover todos os itens até o final. No entanto, o método `splice` modifica o array original em que é chamado. Exemplo:
```js
-var cities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
+const cities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
cities.splice(3, 1);
```
@@ -69,7 +69,8 @@ function nonMutatingSplice(cities) {
// Only change code above this line
}
-var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
+
+const inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
nonMutatingSplice(inputCities);
```
@@ -77,10 +78,7 @@ nonMutatingSplice(inputCities);
```js
function nonMutatingSplice(cities) {
- // Only change code below this line
return cities.slice(0,3);
- // Only change code above this line
}
-var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
-nonMutatingSplice(inputCities);
+const inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
index 54bcac4eb5..6d520e4dc7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
@@ -68,24 +68,23 @@ assert(JSON.stringify(nonMutatingSort([140000, 104, 99])) ===
## --seed-contents--
```js
-var globalArray = [5, 6, 3, 2, 9];
+const globalArray = [5, 6, 3, 2, 9];
+
function nonMutatingSort(arr) {
// Only change code below this line
// Only change code above this line
}
+
nonMutatingSort(globalArray);
```
# --solutions--
```js
-var globalArray = [5, 6, 3, 2, 9];
+const globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
- // Only change code below this line
return [].concat(arr).sort((a,b) => a-b);
- // Only change code above this line
}
-nonMutatingSort(globalArray);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
index 79e0a6cfe5..884d555ac4 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
@@ -13,8 +13,8 @@ O método `slice` retorna uma fatia de elementos de um array. Ele pode receber d
Exemplo:
```js
-var arr = ["Cat", "Dog", "Tiger", "Zebra"];
-var newArray = arr.slice(1, 3);
+const arr = ["Cat", "Dog", "Tiger", "Zebra"];
+const newArray = arr.slice(1, 3);
```
`newArray` terá o valor `["Dog", "Tiger"]`.
@@ -78,7 +78,8 @@ function sliceArray(anim, beginSlice, endSlice) {
// Only change code above this line
}
-var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
+
+const inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
sliceArray(inputAnim, 1, 3);
```
@@ -86,10 +87,7 @@ sliceArray(inputAnim, 1, 3);
```js
function sliceArray(anim, beginSlice, endSlice) {
- // Only change code below this line
- return anim.slice(beginSlice, endSlice)
- // Only change code above this line
+ return anim.slice(beginSlice, endSlice);
}
-var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
-sliceArray(inputAnim, 1, 3);
+const inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
index 6e733a5bcb..33c39df3bb 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
@@ -18,6 +18,7 @@ function ascendingOrder(arr) {
return a - b;
});
}
+
ascendingOrder([1, 5, 2, 3, 4]);
```
@@ -29,6 +30,7 @@ function reverseAlpha(arr) {
return a === b ? 0 : a < b ? 1 : -1;
});
}
+
reverseAlpha(['l', 'h', 'z', 'b', 's']);
```
@@ -86,6 +88,7 @@ function alphabeticalOrder(arr) {
return arr
// Only change code above this line
}
+
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```
@@ -93,9 +96,6 @@ alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```js
function alphabeticalOrder(arr) {
- // Only change code below this line
return arr.sort();
- // Only change code above this line
}
-alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
index 12ff08ab86..b0c70d668d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
@@ -13,11 +13,11 @@ O método `split` divide uma string em um array de strings. Ela recebe um delimi
Abaixo há dois exemplos de uso de split, um separando uma string por espaços, e outro por dígitos usando uma expressão regular:
```js
-var str = "Hello World";
-var bySpace = str.split(" ");
+const str = "Hello World";
+const bySpace = str.split(" ");
-var otherString = "How9are7you2today";
-var byDigits = otherString.split(/\d/);
+const otherString = "How9are7you2today";
+const byDigits = otherString.split(/\d/);
```
`bySpace` terá o valor `["Hello", "World"]` e `byDigits` terá o valor `["How", "are", "you", "today"]`.
@@ -74,6 +74,7 @@ function splitify(str) {
// Only change code above this line
}
+
splitify("Hello World,I-am code");
```
@@ -81,8 +82,6 @@ splitify("Hello World,I-am code");
```js
function splitify(str) {
- // Only change code below this line
return str.split(/\W/);
- // Only change code above this line
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
index 6504a860f3..9f5a8d1c36 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
@@ -59,29 +59,29 @@ assert.deepEqual(finalTabs.tabs, [
```js
// tabs is an array of titles of each site open within the window
-var Window = function(tabs) {
+const Window = function(tabs) {
this.tabs = tabs; // We keep a record of the array inside the object
};
// When you join two windows into one window
-Window.prototype.join = function (otherWindow) {
+Window.prototype.join = function(otherWindow) {
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
};
// When you open a new tab at the end
-Window.prototype.tabOpen = function (tab) {
+Window.prototype.tabOpen = function(tab) {
this.tabs.push('new tab'); // Let's open a new tab for now
return this;
};
// When you close a tab
-Window.prototype.tabClose = function (index) {
+Window.prototype.tabClose = function(index) {
// Only change code below this line
- var tabsBeforeIndex = this.tabs.splice(0, index); // Get the tabs before the tab
- var tabsAfterIndex = this.tabs.splice(index + 1); // Get the tabs after the tab
+ const tabsBeforeIndex = this.tabs.splice(0, index); // Get the tabs before the tab
+ const tabsAfterIndex = this.tabs.splice(index + 1); // Get the tabs after the tab
this.tabs = tabsBeforeIndex.concat(tabsAfterIndex); // Join them together
@@ -91,12 +91,12 @@ Window.prototype.tabClose = function (index) {
};
// Let's create three browser windows
-var workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
-var socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
-var videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
+const workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
+const socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
+const videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
// Now perform the tab opening, closing, and other operations
-var finalTabs = socialWindow
+const finalTabs = socialWindow
.tabOpen() // Open a new tab for cat memes
.join(videoWindow.tabClose(2)) // Close third tab in video window, and join
.join(workWindow.tabClose(1).tabOpen());
@@ -106,40 +106,34 @@ console.log(finalTabs.tabs);
# --solutions--
```js
-// tabs is an array of titles of each site open within the window
-var Window = function(tabs) {
- this.tabs = tabs; // We keep a record of the array inside the object
+const Window = function(tabs) {
+ this.tabs = tabs;
};
-// When you join two windows into one window
-Window.prototype.join = function (otherWindow) {
+Window.prototype.join = function(otherWindow) {
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
};
-// When you open a new tab at the end
-Window.prototype.tabOpen = function (tab) {
- this.tabs.push('new tab'); // Let's open a new tab for now
+Window.prototype.tabOpen = function(tab) {
+ this.tabs.push('new tab');
return this;
};
-// When you close a tab
-Window.prototype.tabClose = function (index) {
- var tabsBeforeIndex = this.tabs.slice(0, index); // Get the tabs before the tab
- var tabsAfterIndex = this.tabs.slice(index + 1); // Get the tabs after the tab
+Window.prototype.tabClose = function(index) {
+ const tabsBeforeIndex = this.tabs.slice(0, index);
+ const tabsAfterIndex = this.tabs.slice(index + 1);
- this.tabs = tabsBeforeIndex.concat(tabsAfterIndex); // Join them together
+ this.tabs = tabsBeforeIndex.concat(tabsAfterIndex);
return this;
};
-// Let's create three browser windows
-var workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']); // Your mailbox, drive, and other work sites
-var socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']); // Social sites
-var videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']); // Entertainment sites
+const workWindow = new Window(['GMail', 'Inbox', 'Work mail', 'Docs', 'freeCodeCamp']);
+const socialWindow = new Window(['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium']);
+const videoWindow = new Window(['Netflix', 'YouTube', 'Vimeo', 'Vine']);
-// Now perform the tab opening, closing, and other operations
-var finalTabs = socialWindow
- .tabOpen() // Open a new tab for cat memes
- .join(videoWindow.tabClose(2)) // Close third tab in video window, and join
+const finalTabs = socialWindow
+ .tabOpen()
+ .join(videoWindow.tabClose(2))
.join(workWindow.tabClose(1).tabOpen());
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
index e4582ceaf8..e060ee8e5d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
@@ -13,7 +13,8 @@ O método `every` funciona verificando se *todos* os elementos de um array passa
Por exemplo, o código a seguir verifica se todos os elementos no array `numbers` são menores que 10:
```js
-var numbers = [1, 5, 8, 0, 10, 11];
+const numbers = [1, 5, 8, 0, 10, 11];
+
numbers.every(function(currentValue) {
return currentValue < 10;
});
@@ -62,6 +63,7 @@ function checkPositive(arr) {
// Only change code above this line
}
+
checkPositive([1, 2, 3, -4, 5]);
```
@@ -69,9 +71,6 @@ checkPositive([1, 2, 3, -4, 5]);
```js
function checkPositive(arr) {
- // Only change code below this line
return arr.every(num => num > 0);
- // Only change code above this line
}
-checkPositive([1, 2, 3, -4, 5]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
index 4b3fbd73b7..7ad02577d7 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
@@ -93,7 +93,7 @@ assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
```js
// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -206,22 +206,22 @@ var watchList = [
}
];
-function getRating(watchList){
+function getRating(watchList) {
// Only change code below this line
- var averageRating;
+ let averageRating;
// Only change code above this line
return averageRating;
}
+
console.log(getRating(watchList));
```
# --solutions--
```js
-// The global variable
-var watchList = [
+const watchList = [
{
"Title": "Inception",
"Year": "2010",
@@ -334,8 +334,8 @@ var watchList = [
}
];
-function getRating(watchList){
- var averageRating;
+function getRating(watchList) {
+ let averageRating;
const rating = watchList
.filter(obj => obj.Director === "Christopher Nolan")
.map(obj => Number(obj.imdbRating));
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
index d0297e13c4..a2d55337a2 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
@@ -13,7 +13,8 @@ O método `some` funciona verificando se *pelo menos um* dos elementos de um arr
Por exemplo, o código a seguir verifica se qualquer elemento no array `numbers` é menor que 10:
```js
-var numbers = [10, 50, 8, 220, 110, 11];
+const numbers = [10, 50, 8, 220, 110, 11];
+
numbers.some(function(currentValue) {
return currentValue < 10;
});
@@ -62,6 +63,7 @@ function checkPositive(arr) {
// Only change code above this line
}
+
checkPositive([1, 2, 3, -4, 5]);
```
@@ -69,9 +71,6 @@ checkPositive([1, 2, 3, -4, 5]);
```js
function checkPositive(arr) {
- // Only change code below this line
return arr.some(elem => elem > 0);
- // Only change code above this line
}
-checkPositive([1, 2, 3, -4, 5]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
index 176f3a943a..87cec648df 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.md
@@ -157,7 +157,7 @@ assert(diffArray([1, 'calf', 3, 'piglet'], [7, 'filly']).length === 6);
```js
function diffArray(arr1, arr2) {
- var newArr = [];
+ const newArr = [];
return newArr;
}
@@ -168,13 +168,12 @@ diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
```js
function diffArray(arr1, arr2) {
- var newArr = [];
- var h1 = Object.create(null);
+ const newArr = [];
+ const h1 = Object.create(null);
arr1.forEach(function(e) {
h1[e] = e;
});
-
- var h2 = Object.create(null);
+ const h2 = Object.create(null);
arr2.forEach(function(e) {
h2[e] = e;
});
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
index 0440792750..c2b1339d6d 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
@@ -23,10 +23,19 @@ Execute os testes para ver a saída esperada para cada método. Os métodos que
# --hints--
-`Object.keys(bob).length` deve retornar 6.
+Nenhuma propriedade deve ser adicionada. `Object.keys(bob).length` deve sempre retornar 6.
```js
-assert.deepEqual(Object.keys(bob).length, 6);
+assert.strictEqual(
+ Object.keys((function () {
+ let bob = new Person('Bob Ross');
+ bob.setFirstName('Haskell');
+ bob.setLastName('Curry');
+ bob.setFullName('John Smith');
+ return bob;
+ })()).length,
+ 6
+ );
```
`bob instanceof Pessoa` deve retornar `true`.
@@ -139,7 +148,7 @@ if(bob){
## --seed-contents--
```js
-var Person = function(firstAndLast) {
+const Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
this.getFullName = function() {
@@ -148,16 +157,16 @@ var Person = function(firstAndLast) {
return firstAndLast;
};
-var bob = new Person('Bob Ross');
+const bob = new Person('Bob Ross');
bob.getFullName();
```
# --solutions--
```js
-var Person = function(firstAndLast) {
+const Person = function(firstAndLast) {
- var firstName, lastName;
+ let firstName, lastName;
function updateName(str) {
firstName = str.split(" ")[0];
@@ -192,6 +201,6 @@ var Person = function(firstAndLast) {
};
};
-var bob = new Person('Bob Ross');
+const bob = new Person('Bob Ross');
bob.getFullName();
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
index 5d7e434445..ffbbd4805e 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
@@ -51,8 +51,8 @@ assert.deepEqual(
```js
function orbitalPeriod(arr) {
- var GM = 398600.4418;
- var earthRadius = 6367.4447;
+ const GM = 398600.4418;
+ const earthRadius = 6367.4447;
return arr;
}
@@ -63,9 +63,9 @@ orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
```js
function orbitalPeriod(arr) {
- var GM = 398600.4418;
- var earthRadius = 6367.4447;
- var TAU = 2 * Math.PI;
+ const GM = 398600.4418;
+ const earthRadius = 6367.4447;
+ const TAU = 2 * Math.PI;
return arr.map(function(obj) {
return {
name: obj.name,
@@ -73,6 +73,4 @@ function orbitalPeriod(arr) {
};
});
}
-
-orbitalPeriod([{name : "sputkin", avgAlt : 35873.5553}]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
index 4991be8782..46a74b2584 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
@@ -61,7 +61,6 @@ function smallestCommons(arr) {
return arr;
}
-
smallestCommons([1,5]);
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
index afdff0e631..4191a51121 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
@@ -103,7 +103,7 @@ assert.deepEqual(
```js
function whatIsInAName(collection, source) {
- var arr = [];
+ const arr = [];
// Only change code below this line
@@ -118,8 +118,8 @@ whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last:
```js
function whatIsInAName(collection, source) {
- var arr = [];
- var keys = Object.keys(source);
+ const arr = [];
+ const keys = Object.keys(source);
collection.forEach(function(e) {
if(keys.every(function(key) {return e[key] === source[key];})) {
arr.push(e);
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
index a5aa3e63ce..a5795068b3 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.md
@@ -51,7 +51,6 @@ assert(
```js
function rot13(str) {
-
return str;
}
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
index 283ed15f2b..4ddb07a518 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.md
@@ -186,7 +186,7 @@ assert.deepEqual(
```js
function checkCashRegister(price, cash, cid) {
- var change;
+ let change;
return change;
}
@@ -196,54 +196,57 @@ checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], [
# --solutions--
```js
-var denom = [
- { name: 'ONE HUNDRED', val: 100},
- { name: 'TWENTY', val: 20},
- { name: 'TEN', val: 10},
- { name: 'FIVE', val: 5},
- { name: 'ONE', val: 1},
- { name: 'QUARTER', val: 0.25},
- { name: 'DIME', val: 0.1},
- { name: 'NICKEL', val: 0.05},
- { name: 'PENNY', val: 0.01}
+const denom = [
+ { name: "ONE HUNDRED", val: 100 },
+ { name: "TWENTY", val: 20 },
+ { name: "TEN", val: 10 },
+ { name: "FIVE", val: 5 },
+ { name: "ONE", val: 1 },
+ { name: "QUARTER", val: 0.25 },
+ { name: "DIME", val: 0.1 },
+ { name: "NICKEL", val: 0.05 },
+ { name: "PENNY", val: 0.01 },
];
function checkCashRegister(price, cash, cid) {
- var output = {status: null, change: []};
- var change = cash - price;
- var register = cid.reduce(function(acc, curr) {
- acc.total += curr[1];
- acc[curr[0]] = curr[1];
- return acc;
- }, {total: 0});
- if(register.total === change) {
- output.status = 'CLOSED';
- output.change = cid;
- return output;
- }
- if(register.total < change) {
- output.status = 'INSUFFICIENT_FUNDS';
- return output;
- }
- var change_arr = denom.reduce(function(acc, curr) {
- var value = 0;
- while(register[curr.name] > 0 && change >= curr.val) {
- change -= curr.val;
- register[curr.name] -= curr.val;
- value += curr.val;
- change = Math.round(change * 100) / 100;
- }
- if(value > 0) {
- acc.push([ curr.name, value ]);
- }
- return acc;
- }, []);
- if(change_arr.length < 1 || change > 0) {
- output.status = 'INSUFFICIENT_FUNDS';
- return output;
- }
- output.status = 'OPEN';
- output.change = change_arr;
- return output;
+ const output = { status: null, change: [] };
+ let change = cash - price;
+ const register = cid.reduce(
+ function (acc, curr) {
+ acc.total += curr[1];
+ acc[curr[0]] = curr[1];
+ return acc;
+ },
+ { total: 0 }
+ );
+ if (register.total === change) {
+ output.status = "CLOSED";
+ output.change = cid;
+ return output;
+ }
+ if (register.total < change) {
+ output.status = "INSUFFICIENT_FUNDS";
+ return output;
+ }
+ const change_arr = denom.reduce(function (acc, curr) {
+ let value = 0;
+ while (register[curr.name] > 0 && change >= curr.val) {
+ change -= curr.val;
+ register[curr.name] -= curr.val;
+ value += curr.val;
+ change = Math.round(change * 100) / 100;
+ }
+ if (value > 0) {
+ acc.push([curr.name, value]);
+ }
+ return acc;
+ }, []);
+ if (change_arr.length < 1 || change > 0) {
+ output.status = "INSUFFICIENT_FUNDS";
+ return output;
+ }
+ output.status = "OPEN";
+ output.change = change_arr;
+ return output;
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
index ed254b9ac9..2582b57d2f 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.md
@@ -107,8 +107,6 @@ function palindrome(str) {
return true;
}
-
-
palindrome("eye");
```
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
index 11b9de70eb..73c349f709 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/front-end-development-libraries-projects/build-a-markdown-previewer.md
@@ -22,7 +22,7 @@ Você pode usar qualquer mistura de HTML, JavaScript, CSS, Bootstrap, SASS, Reac
**Especificação de usuário nº 4:** quando insiro marcação do GitHub no elemento `#editor`, o texto é renderizado como HTML no elemento `#preview` enquanto eu escrevo (DICA: você não precisa analisar a marcação você mesmo - você pode importar a biblioteca Marked para isso: ).
-**Especificação de usuário nº 5:** quando meu pré-visualizador de marcação carregar pela primeira vez, o texto padrão no campo `#editor` deve conter uma marcação válida que represente pelo menos um de cada um dos elementos a seguir: um header (tamanho H1), um subheader (tamanho H2), um link, um código em linha, um código de bloco, uma lista de item, um blockquote, uma imagem e um texto em negrito.
+**Especificação de usuário nº 5:** quando meu pré-visualizador de marcação carregar pela primeira vez, o texto padrão no campo `#editor` deve conter uma marcação válida que represente pelo menos um de cada um dos elementos a seguir: um elemento (tamanho H1), um subelemento de título (tamanho H2), um link, um código em linha, um código de bloco, uma lista de item, um blockquote, uma imagem e um texto em negrito.
**Especificação de usuário nº 6:** quando meu pré-visualizador de marcação carregar pela primeira vez, a marcação padrão no campo `#editor` deve ser renderizada como HTML no elemento `#preview`.
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/access-props-using-this.props.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/access-props-using-this.props.md
index 49d8f70179..ab80387e9b 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/access-props-using-this.props.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/access-props-using-this.props.md
@@ -14,67 +14,54 @@ Sempre que você se refere a um componente de classe dentro dele mesmo, você us
# --instructions--
-Renderize uma instância do componente `ReturnTempPassword` no componente parente `ResetPassword`. Aqui, dê a `ReturnTempPassword` à prop `tempPassword` e atribua a ela o valor de uma string que tenha pelo menos 8 caracteres. Dentro do filho, `ReturnTempPassword`, acesse a prop `tempPassword` dentro das tags `strong` para certificar-se que o usuário veja a senha temporária.
+Renderize uma instância do componente `Welcome` no componente parente `App`. Aqui, dê a `Welcome` uma "prop" `name` e atribua a ela um valor de uma string. Dentro do elemento filho, `Welcome`, acesse a propriedade `name` dentro das tags `strong`.
# --hints--
-O componente `ResetPassword` deve retornar um único elemento `div`.
+O componente `App` deve retornar um único elemento `div`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return mockedComponent.children().type() === 'div';
})()
);
```
-O quarto filho de `ResetPassword` deve ser o componente `ReturnTempPassword`.
+O elemento filho de `App` deve ser o componente `Welcome`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return (
- mockedComponent.children().childAt(3).name() === 'ReturnTempPassword'
+ mockedComponent.children().childAt(0).name() === 'Welcome'
);
})()
);
```
-O componente `ReturnTempPassword` deve ter uma prop chamada `tempPassword`.
+O componente `Welcome` deve ter uma prop chamada `name`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
- return mockedComponent.find('ReturnTempPassword').props().tempPassword;
+ const mockedComponent = Enzyme.mount(React.createElement(App));
+ return mockedComponent.find('Welcome').props().name;
})()
);
```
-A prop `tempPassword` de `ReturnTempPassword` deve ser igual uma string de pelo menos 8 caracteres.
+O componente `Welcome` deve exibir a string que você passou como a prop `name` dentro das tags `strong`.
```js
assert(
(function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
- const temp = mockedComponent.find('ReturnTempPassword').props()
- .tempPassword;
- return typeof temp === 'string' && temp.length >= 8;
- })()
-);
-```
-
-O componente `ReturnTempPassword` deve exibir a senha que você criou como a prop `tempPassword` dentro das tags `strong`.
-
-```js
-assert(
- (function () {
- const mockedComponent = Enzyme.mount(React.createElement(ResetPassword));
+ const mockedComponent = Enzyme.mount(React.createElement(App));
return (
mockedComponent.find('strong').text() ===
- mockedComponent.find('ReturnTempPassword').props().tempPassword
+ mockedComponent.find('Welcome').props().name
);
})()
);
@@ -85,13 +72,13 @@ assert(
## --after-user-code--
```jsx
-ReactDOM.render(, document.getElementById('root'))
+ReactDOM.render(, document.getElementById('root'))
```
## --seed-contents--
```jsx
-class ReturnTempPassword extends React.Component {
+class App extends React.Component {
constructor(props) {
super(props);
@@ -100,14 +87,14 @@ class ReturnTempPassword extends React.Component {
return (
{ /* Change code below this line */ }
-
Your temporary password is:
+
{ /* Change code above this line */ }
);
}
};
-class ResetPassword extends React.Component {
+class Welcome extends React.Component {
constructor(props) {
super(props);
@@ -115,11 +102,8 @@ class ResetPassword extends React.Component {
render() {
return (
-
Reset Password
-
We've generated a new temporary password for you.
-
Please reset this password from your account settings ASAP.
{ /* Change code below this line */ }
-
+
Hello, !
{ /* Change code above this line */ }
);
@@ -130,7 +114,7 @@ class ResetPassword extends React.Component {
# --solutions--
```jsx
-class ReturnTempPassword extends React.Component {
+class Welcome extends React.Component {
constructor(props) {
super(props);
@@ -138,28 +122,27 @@ class ReturnTempPassword extends React.Component {
render() {
return (
-
Your temporary password is: {this.props.tempPassword}
-
- );
- }
-};
-
-class ResetPassword extends React.Component {
- constructor(props) {
- super(props);
-
- }
- render() {
- return (
-
-
Reset Password
-
We've generated a new temporary password for you.
-
Please reset this password from your account settings ASAP.
{ /* Change code below this line */ }
-
+
Hello, {this.props.name}!
{ /* Change code above this line */ }
);
}
};
+
+class App extends React.Component {
+ constructor(props) {
+ super(props);
+
+ }
+ render() {
+ return (
+
+ { /* Change code below this line */ }
+
+ { /* Change code above this line */ }
+
+ );
+ }
+};
```
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/compose-react-components.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/compose-react-components.md
index bd8348bd7e..0ec0809f81 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/compose-react-components.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/compose-react-components.md
@@ -14,7 +14,7 @@ Enquanto os desafios continuam a usar composições mais complexas com component
No editor de código, o componente `TypesOfFood` já está renderizando um componente chamado `Vegetables`. Além disso, há o componente `Fruits` do último desafio.
-Aninhe dois componentes dentro de `Fruits` — primeiro `NonCitrus`, e depois `Citrus`. Ambos os componentes são fornecidos nos bastidores. Em seguida, aninhe o componente de classe `Fruits` dentro do componente `TypesOfFood`, abaixo do cabeçalho `h1` e acima de `Vegetables`. O resultado deve ser uma série de componentes aninhados, que usa dois tipos de componentes diferentes.
+Aninhe dois componentes dentro de `Fruits` — primeiro `NonCitrus`, e depois `Citrus`. Ambos os componentes são fornecidos nos bastidores. Em seguida, aninhe o componente de classe `Fruits` dentro do componente `TypesOfFood`, abaixo do elemento de título `h1` e acima de `Vegetables`. O resultado deve ser uma série de componentes aninhados, que usa dois tipos de componentes diferentes.
# --hints--
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-controlled-form.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-controlled-form.md
index 1ee0593fbd..25f93e75cf 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-controlled-form.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-controlled-form.md
@@ -109,7 +109,7 @@ assert(
);
```
-O título `h1` deve renderizar o valor do campo `submit` do estado do componente.
+O elemento de título `h1` deve renderizar o valor do campo `submit` do estado do componente.
```js
(() => {
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-react-component.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-react-component.md
index a123ce7cc7..b06f7b3308 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-react-component.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/create-a-react-component.md
@@ -38,7 +38,7 @@ O componente React deve retornar um elemento `div`.
assert(Enzyme.shallow(React.createElement(MyComponent)).type() === 'div');
```
-A `div` retornada deve renderizar um título `h1` dentro dele.
+A `div` retornada deve renderizar um elemento de título `h1` dentro dele.
```js
assert(
@@ -48,7 +48,7 @@ assert(
);
```
-O título `h1` deve conter a string `Hello React!`.
+O elemento de título `h1` deve conter a string `Hello React!`.
```js
assert(
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
index b711aee1c5..4a96203184 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface-another-way.md
@@ -27,7 +27,7 @@ assert(
);
```
-`MyComponent` deve renderizar um título `h1` que está dentro de um único `div`.
+`MyComponent` deve renderizar um elemento de título `h1` que está dentro de um único `div`.
```js
assert(
@@ -44,7 +44,7 @@ A tag `h1` renderizada deve ter uma referência a `{name}`.
assert(/\n*\s*\{\s*name\s*\}\s*\n*<\/h1>/.test(getUserInput('index')));
```
-O título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
+O elemento de título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
```js
async () => {
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
index 56604246e1..6b8c7aae11 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/render-state-in-the-user-interface.md
@@ -33,7 +33,7 @@ assert(
);
```
-`MyComponent` deve renderizar um título `h1` que está dentro de um único `div`.
+`MyComponent` deve renderizar um elemento de título `h1` que está dentro de um único `div`.
```js
assert(
@@ -43,7 +43,7 @@ assert(
);
```
-O título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
+O elemento de título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
```js
async () => {
diff --git a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/set-state-with-this.setstate.md b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/set-state-with-this.setstate.md
index a3e26d5e0a..95d02d99e7 100644
--- a/curriculum/challenges/portuguese/03-front-end-development-libraries/react/set-state-with-this.setstate.md
+++ b/curriculum/challenges/portuguese/03-front-end-development-libraries/react/set-state-with-this.setstate.md
@@ -35,13 +35,13 @@ assert(
);
```
-`MyComponent` deve retornar um título `h1`.
+`MyComponent` deve retornar um elemento de título `h1`.
```js
assert(Enzyme.mount(React.createElement(MyComponent)).find('h1').length === 1);
```
-O título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
+O elemento de título `h1` renderizado deve conter apenas texto renderizado do estado do componente.
```js
async () => {
diff --git a/curriculum/challenges/portuguese/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md b/curriculum/challenges/portuguese/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
index 29531b1d6d..ccb30068d6 100644
--- a/curriculum/challenges/portuguese/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
+++ b/curriculum/challenges/portuguese/05-back-end-development-and-apis/basic-node-and-express/use-the-.env-file.md
@@ -22,6 +22,8 @@ Em seguida, no manipulador de rota `/json` do GET que você criou no último des
**Observação:** se você estiver usando o Replit, você não poderá criar um arquivo `.env`. Em vez disso, use a aba embutida SECRETS para adicionar a variável.
+Se você estiver trabalhando localmente, precisará do pacote `dotenv`. Ele carrega as variáveis de ambiente do seu arquivo `.env` em `process.env`. Instale-o com `npm install dotenv`. Em seguida, na parte superior do seu arquivo `myApp.js`, importe e carregue as variáveis com `require('dotenv').config()`.
+
# --hints--
A resposta do endpoint `/json` deve ser alterada de acordo com a variável de ambiente `MESSAGE_STYLE`
diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
index 65a3cb21ff..a6c71d5b4a 100644
--- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
+++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md
@@ -46,6 +46,25 @@ assert(
);
```
+Tentar remover um elemento de uma árvore vazia deve retornar `null`.
+
+```js
+assert(
+ (function () {
+ var test = false;
+ if (typeof BinarySearchTree !== 'undefined') {
+ test = new BinarySearchTree();
+ } else {
+ return false;
+ }
+ if (typeof test.remove !== 'function') {
+ return false;
+ }
+ return test.remove(100) == null;
+ })()
+);
+```
+
Tentar remover um elemento que não existe deve retornar `null`.
```js
@@ -60,6 +79,8 @@ assert(
if (typeof test.remove !== 'function') {
return false;
}
+ test.add(15);
+ test.add(30);
return test.remove(100) == null;
})()
);
diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.md b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.md
index 42c0555768..ecc0ec5348 100644
--- a/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.md
+++ b/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.md
@@ -22,7 +22,7 @@ Podemos ver que essa sequência (começando em 13 e terminando em 1) contém 10
Qual número inicial, sob o `limit` (limite) definido, produz a sequência mais longa?
-**Observação:** uma vez iniciada, os termos na sequência podem passar de um milhão.
+**Observação:** uma vez iniciada, os termos na sequência podem passar acima do `limit`.
# --hints--