mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-14 16:00:40 -04:00
chore(i18n,learn): processed translations (#54537)
Co-authored-by: Naomi <nhcarrigan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
adfb87e898
commit
e6b05ee25d
@@ -54,7 +54,7 @@ Dovresti accedere ai dati nella variabile `myArray` usando la notazione a parent
|
||||
```js
|
||||
assert(
|
||||
(function () {
|
||||
if (code.match(/\s*=\s*myArray\[0\]/g)) {
|
||||
if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -45,7 +45,7 @@ assert(myData === 8);
|
||||
Dovresti usare la notazione parentesi per leggere il valore corretto da `myArray`.
|
||||
|
||||
```js
|
||||
assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code)));
|
||||
assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -54,7 +54,7 @@ assert(secondTree === 'pine');
|
||||
Il tuo codice dovrebbe utilizzare la notazione a punti e parentesi per accedere a `myPlants`.
|
||||
|
||||
```js
|
||||
assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
|
||||
assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -64,7 +64,7 @@ assert(drinkValue === 'water');
|
||||
Dovresti usare due volte la notazione a parentesi
|
||||
|
||||
```js
|
||||
assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -60,7 +60,7 @@ assert(shirtValue === 'jersey');
|
||||
Dovresti usare due volte la notazione a punti
|
||||
|
||||
```js
|
||||
assert(code.match(/testObj\.\w+/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -56,19 +56,19 @@ assert(player === 'Montana');
|
||||
Dovresti usare la notazione a parentesi per accedere a `testObj`
|
||||
|
||||
```js
|
||||
assert(/testObj\s*?\[.*?\]/.test(code));
|
||||
assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Non dovresti assegnare direttamente il valore `Montana` alla variabile `player`.
|
||||
|
||||
```js
|
||||
assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
|
||||
assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
|
||||
```
|
||||
|
||||
Dovresti usare la variabile `playerNumber` nella notazione a parentesi
|
||||
|
||||
```js
|
||||
assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
|
||||
assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -53,7 +53,7 @@ assert(myDog.bark !== undefined);
|
||||
Non dovresti aggiungere `bark` all'inizializzazione di `myDog`.
|
||||
|
||||
```js
|
||||
assert(!/bark[^\n]:/.test(code));
|
||||
assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -38,7 +38,7 @@ assert(sum === 20);
|
||||
Dovresti usare l'operatore `+`.
|
||||
|
||||
```js
|
||||
assert(/\+/.test(code));
|
||||
assert(/\+/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff');
|
||||
Non dovresti usare alcuna dichiarazione `if` o `else`
|
||||
|
||||
```js
|
||||
assert(!/else/g.test(code) || !/if/g.test(code));
|
||||
assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti usare un'istruzione `default`
|
||||
@@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff');
|
||||
Dovresti avere almeno altre 3 `break` istruzioni
|
||||
|
||||
```js
|
||||
assert(code.match(/break/g).length > 2);
|
||||
assert(__helpers.removeJSComments(code).match(/break/g).length > 2);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2);
|
||||
Dovresti aggiungere `someAdjective` a `myStr` usando l'operatore `+=`.
|
||||
|
||||
```js
|
||||
assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -29,7 +29,7 @@ Assegna il contenuto di `a` alla variabile `b`.
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code));
|
||||
assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`b` dovrebbe avere un valore di `7`.
|
||||
@@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7);
|
||||
`a` dovrebbe essere assegnato a `b` con `=`.
|
||||
|
||||
```js
|
||||
assert(/b\s*=\s*a\s*/g.test(code));
|
||||
assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -34,7 +34,7 @@ assert(processed === 2);
|
||||
Dovresti assegnare `processArg` a `processed`
|
||||
|
||||
```js
|
||||
assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code));
|
||||
assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,19 +39,19 @@ Scrivi delle istruzioni `if`/`else if` concatenate per soddisfare le seguenti co
|
||||
Dovresti avere almeno quattro istruzioni `else`
|
||||
|
||||
```js
|
||||
assert(code.match(/else/g).length > 3);
|
||||
assert(__helpers.removeJSComments(code).match(/else/g).length > 3);
|
||||
```
|
||||
|
||||
Dovresti avere almeno quattro istruzioni `if`
|
||||
|
||||
```js
|
||||
assert(code.match(/if/g).length > 3);
|
||||
assert(__helpers.removeJSComments(code).match(/if/g).length > 3);
|
||||
```
|
||||
|
||||
Dovresti avere almeno un'istruzione `return`
|
||||
|
||||
```js
|
||||
assert(code.match(/return/g).length >= 1);
|
||||
assert(__helpers.removeJSComments(code).match(/return/g).length >= 1);
|
||||
```
|
||||
|
||||
`testSize(0)` dovrebbe restituire la stringa `Tiny`
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
id: bd7123c9c441eddfaeb4bdef
|
||||
title: Commentare il codice JavaScript
|
||||
challengeType: 1
|
||||
removeComments: false
|
||||
videoUrl: 'https://scrimba.com/c/c7ynnTp'
|
||||
forumTopicId: 16783
|
||||
dashedName: comment-your-javascript-code
|
||||
|
||||
@@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal');
|
||||
Dovresti usare l'operatore `==`
|
||||
|
||||
```js
|
||||
assert(code.match(/==/g) && !code.match(/===/g));
|
||||
assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100');
|
||||
Dovresti utilizzare l'operatore `>` almeno due volte
|
||||
|
||||
```js
|
||||
assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over');
|
||||
Dovresti utilizzare l'operatore `>=` almeno due volte
|
||||
|
||||
```js
|
||||
assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal');
|
||||
Dovresti utilizzare l'operatore `!=`
|
||||
|
||||
```js
|
||||
assert(code.match(/(?!!==)!=/));
|
||||
assert(__helpers.removeJSComments(code).match(/(?!!==)!=/));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over');
|
||||
Dovresti utilizzare l'operatore `<` almeno due volte
|
||||
|
||||
```js
|
||||
assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24');
|
||||
Dovresti utilizzare l'operatore `<=` almeno due volte
|
||||
|
||||
```js
|
||||
assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal');
|
||||
Dovresti usare l'operatore `===`
|
||||
|
||||
```js
|
||||
assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal');
|
||||
Dovresti usare l'operatore `!==`
|
||||
|
||||
```js
|
||||
assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -40,13 +40,13 @@ Sostituisci i due if con una sola istruzione, utilizzando l’operatore `&&`, ch
|
||||
Dovresti utilizzare l'operatore `&&` una sola volta
|
||||
|
||||
```js
|
||||
assert(code.match(/&&/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/&&/g).length === 1);
|
||||
```
|
||||
|
||||
Dovresti avere una sola istruzione `if`
|
||||
|
||||
```js
|
||||
assert(code.match(/if/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/if/g).length === 1);
|
||||
```
|
||||
|
||||
`testLogicalAnd(0)` dovrebbe restituire la stringa `No`
|
||||
|
||||
@@ -43,13 +43,13 @@ Combina le due istruzioni `if` in un'unica istruzione che restituisca la stringa
|
||||
Dovresti usare l'operatore `||` una sola volta
|
||||
|
||||
```js
|
||||
assert(code.match(/\|\|/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1);
|
||||
```
|
||||
|
||||
Dovresti avere una sola istruzione `if`
|
||||
|
||||
```js
|
||||
assert(code.match(/if/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/if/g).length === 1);
|
||||
```
|
||||
|
||||
`testLogicalOr(0)` dovrebbe restituire la stringa `Outside`
|
||||
|
||||
@@ -54,16 +54,16 @@ assert(c === 19);
|
||||
Dovresti usare l'operatore `+=` per ogni variabile.
|
||||
|
||||
```js
|
||||
assert(code.match(/\+=/g).length === 3);
|
||||
assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3);
|
||||
```
|
||||
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/let a = 3;/.test(code) &&
|
||||
/let b = 17;/.test(code) &&
|
||||
/let c = 12;/.test(code)
|
||||
/let a = 3;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let b = 17;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let c = 12;/.test(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -48,16 +48,16 @@ assert(c === 3);
|
||||
Dovresti usare l'operatore `/=` per ogni variabile.
|
||||
|
||||
```js
|
||||
assert(code.match(/\/=/g).length === 3);
|
||||
assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3);
|
||||
```
|
||||
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/let a = 48;/.test(code) &&
|
||||
/let b = 108;/.test(code) &&
|
||||
/let c = 33;/.test(code)
|
||||
/let a = 48;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let b = 108;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let c = 33;/.test(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -48,16 +48,16 @@ assert(c === 46);
|
||||
Dovresti usare l'operatore `*=` per ogni variabile.
|
||||
|
||||
```js
|
||||
assert(code.match(/\*=/g).length === 3);
|
||||
assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3);
|
||||
```
|
||||
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/let a = 5;/.test(code) &&
|
||||
/let b = 12;/.test(code) &&
|
||||
/let c = 4\.6;/.test(code)
|
||||
/let a = 5;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let b = 12;/.test(__helpers.removeJSComments(code)) &&
|
||||
/let c = 4\.6;/.test(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ assert(c === 2);
|
||||
Dovresti usare l'operatore `-=` per ogni variabile.
|
||||
|
||||
```js
|
||||
assert(code.match(/-=/g).length === 3);
|
||||
assert(__helpers.removeJSComments(code).match(/-=/g).length === 3);
|
||||
```
|
||||
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code)
|
||||
/let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.');
|
||||
Dovresti usare l'operatore `+` per costruire `myStr`.
|
||||
|
||||
```js
|
||||
assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g));
|
||||
assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g));
|
||||
```
|
||||
|
||||
`myStr` dovrebbe essere creato usando la parola chiave `const`.
|
||||
|
||||
```js
|
||||
assert(/const\s+myStr/.test(code));
|
||||
assert(/const\s+myStr/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti assegnare il risultato alla variabile `myStr`.
|
||||
|
||||
```js
|
||||
assert(/myStr\s*=/.test(code));
|
||||
assert(/myStr\s*=/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.');
|
||||
Dovresti usare l'operatore `+=` per costruire `myStr`.
|
||||
|
||||
```js
|
||||
assert(code.match(/myStr\s*\+=\s*(["']).*\1/g));
|
||||
assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2);
|
||||
Dovresti usare due operatori `+` per costruire `myStr` con `myName` al suo interno.
|
||||
|
||||
```js
|
||||
assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -34,13 +34,13 @@ Inserisci i numeri dispari da 9 a 1 in `myArray` usando un ciclo `for`.
|
||||
Dovresti usare un ciclo `for` per questo.
|
||||
|
||||
```js
|
||||
assert(/for\s*\([^)]+?\)/.test(code));
|
||||
assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti usare il metodo array `push`.
|
||||
|
||||
```js
|
||||
assert(code.match(/myArray.push/));
|
||||
assert(__helpers.removeJSComments(code).match(/myArray.push/));
|
||||
```
|
||||
|
||||
`myArray` dovrebbe essere uguale a `[9, 7, 5, 3, 1]`.
|
||||
|
||||
@@ -37,7 +37,7 @@ Guarda l'esempio `ourName` qui sopra se sei bloccato.
|
||||
Dovresti dichiarare `myName` con la parola chiave `var` terminando con un punto e virgola
|
||||
|
||||
```js
|
||||
assert(/var\s+myName\s*;/.test(code));
|
||||
assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -38,25 +38,25 @@ assert(myVar === 10);
|
||||
`myVar = myVar - 1;` dovrebbe essere modificato.
|
||||
|
||||
```js
|
||||
assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/));
|
||||
assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/));
|
||||
```
|
||||
|
||||
Non dovresti assegnare `10` a `myVar`.
|
||||
|
||||
```js
|
||||
assert(!code.match(/myVar\s*=\s*10.*?;?/));
|
||||
assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/));
|
||||
```
|
||||
|
||||
Dovresti usare l'operatore `--` su `myVar`.
|
||||
|
||||
```js
|
||||
assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
|
||||
assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Non dovresti modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(/let myVar = 11;/.test(code));
|
||||
assert(/let myVar = 11;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined);
|
||||
Non dovresti modificare il setup di `myDog`.
|
||||
|
||||
```js
|
||||
assert(code.match(/"tails": 1/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -26,13 +26,13 @@ assert(quotient === 2.2);
|
||||
Dovresti usare l'operatore `/` per dividere 4.4 per 2
|
||||
|
||||
```js
|
||||
assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
|
||||
assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
La variabile quotient deve essere assegnata solo una volta
|
||||
|
||||
```js
|
||||
assert(code.match(/quotient\s*=/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -35,7 +35,7 @@ assert(quotient === 2);
|
||||
Dovresti usare l'operatore `/`.
|
||||
|
||||
```js
|
||||
assert(/\d+\s*\/\s*\d+/.test(code));
|
||||
assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes".
|
||||
Dovresti usare due virgolette doppie (`"`) e quattro virgolette doppie con escape (`\"`).
|
||||
|
||||
```js
|
||||
assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2);
|
||||
assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2);
|
||||
```
|
||||
|
||||
La variabile `myStr` dovrebbe contenere la stringa: `I am a "double quoted" string inside "double quotes".`
|
||||
|
||||
@@ -29,8 +29,8 @@ Non dovresti cambiare le dichiarazioni della variabile nella sezione `// Setup`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(/let lastNameLength = 0;/) &&
|
||||
code.match(/const lastName = "Lovelace";/)
|
||||
__helpers.removeJSComments(code).match(/let lastNameLength = 0;/) &&
|
||||
__helpers.removeJSComments(code).match(/const lastName = "Lovelace";/)
|
||||
);
|
||||
```
|
||||
|
||||
@@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
|
||||
Dovresti ottenere la lunghezza di `lastName` utilizzando `.length` in questo modo: `lastName.length`.
|
||||
|
||||
```js
|
||||
assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
|
||||
assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,7 +39,7 @@ Imposta `remainder` pari al resto di `11` diviso per `3` utilizzando l'operatore
|
||||
La variabile `remainder` dovrebbe essere inizializzata
|
||||
|
||||
```js
|
||||
assert(/(const|let|var)\s+?remainder/.test(code));
|
||||
assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Il valore di `remainder` dovrebbe essere `2`
|
||||
@@ -51,7 +51,7 @@ assert(remainder === 2);
|
||||
Dovresti utilizzare l'operatore `%`
|
||||
|
||||
```js
|
||||
assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
|
||||
assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g));
|
||||
Dovresti usare `Math.random` per generare il numero decimale casuale.
|
||||
|
||||
```js
|
||||
assert(code.match(/Math\.random/g).length >= 0);
|
||||
assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -46,22 +46,22 @@ assert(
|
||||
Dovresti usare `Math.random` per generare un numero casuale.
|
||||
|
||||
```js
|
||||
assert(code.match(/Math.random/g).length >= 1);
|
||||
assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1);
|
||||
```
|
||||
|
||||
Dovresti moltiplicare il risultato di `Math.random` per 10 per ottenere un numero nell'intervallo tra zero e nove.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) ||
|
||||
code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g)
|
||||
__helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) ||
|
||||
__helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g)
|
||||
);
|
||||
```
|
||||
|
||||
Dovresti usare `Math.floor` per rimuovere la parte decimale del numero.
|
||||
|
||||
```js
|
||||
assert(code.match(/Math.floor/g).length >= 1);
|
||||
assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0);
|
||||
assert(
|
||||
(function () {
|
||||
if (
|
||||
code.match(/myMax/g).length > 1 &&
|
||||
code.match(/myMin/g).length > 2 &&
|
||||
code.match(/Math.floor/g) &&
|
||||
code.match(/Math.random/g)
|
||||
__helpers.removeJSComments(code).match(/myMax/g).length > 1 &&
|
||||
__helpers.removeJSComments(code).match(/myMin/g).length > 2 &&
|
||||
__helpers.removeJSComments(code).match(/Math.floor/g) &&
|
||||
__helpers.removeJSComments(code).match(/Math.random/g)
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,7 @@ assert(myGlobal === 10);
|
||||
`myGlobal` dovrebbe essere dichiarata usando la parola chiave `let` o `const`
|
||||
|
||||
```js
|
||||
assert(/(let|const)\s+myGlobal/.test(code));
|
||||
assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`oopsGlobal` dovrebbe essere una variabile globale e avere un valore di `5`
|
||||
|
||||
@@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater');
|
||||
Non dovresti cambiare l'istruzione return.
|
||||
|
||||
```js
|
||||
assert(/return outerWear/.test(code));
|
||||
assert(/return outerWear/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,20 +39,20 @@ Non dovresti utilizzare l'operatore di assegnazione.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/let\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(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
Dovresti usare l'operatore `++`.
|
||||
|
||||
```js
|
||||
assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
|
||||
assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Non dovresti cambiare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(/let myVar = 87;/.test(code));
|
||||
assert(/let myVar = 87;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -26,7 +26,7 @@ Definisci una variabile `a` con `var` e inizializzala ad un valore di `9`.
|
||||
Dovresti inizializzare `a` ad un valore di `9`.
|
||||
|
||||
```js
|
||||
assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code));
|
||||
assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -30,20 +30,20 @@ Converti la logica per usare le istruzioni `else if`.
|
||||
Dovresti avere almeno due istruzioni `else`
|
||||
|
||||
```js
|
||||
assert(code.match(/else/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/else/g).length > 1);
|
||||
```
|
||||
|
||||
Dovresti avere almeno due istruzioni `if`
|
||||
|
||||
```js
|
||||
assert(code.match(/if/g).length > 1);
|
||||
assert(__helpers.removeJSComments(code).match(/if/g).length > 1);
|
||||
```
|
||||
|
||||
Dovresti avere una parentesi graffa di apertura e una di chiusura per ogni blocco di codice `if else`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
__helpers.removeJSComments(code).match(
|
||||
/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/
|
||||
)
|
||||
);
|
||||
|
||||
@@ -28,13 +28,13 @@ Combina le istruzioni `if` in una singola istruzione `if/else`.
|
||||
Dovresti avere una sola istruzione `if` nell'editor
|
||||
|
||||
```js
|
||||
assert(code.match(/if/g).length === 1);
|
||||
assert(__helpers.removeJSComments(code).match(/if/g).length === 1);
|
||||
```
|
||||
|
||||
Dovresti usare una istruzione `else`
|
||||
|
||||
```js
|
||||
assert(/else/g.test(code));
|
||||
assert(/else/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`testElse(4)` dovrebbe restituire la stringa `5 or Smaller`
|
||||
@@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5');
|
||||
Non dovresti modificare il codice sopra o sotto i commenti specificati.
|
||||
|
||||
```js
|
||||
assert(/let result = "";/.test(code) && /return result;/.test(code));
|
||||
assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -32,7 +32,7 @@ Inserisci i numeri dispari da 1 a 9 in `myArray` usando un ciclo `for`.
|
||||
Dovresti usare un ciclo `for`.
|
||||
|
||||
```js
|
||||
assert(/for\s*\([^)]+?\)/.test(code));
|
||||
assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`myArray` dovrebbe essere uguale a `[1, 3, 5, 7, 9]`.
|
||||
|
||||
@@ -30,7 +30,7 @@ Dichiara una variabile `total` e inizializzala a `0`. Usa un ciclo `for` per som
|
||||
`total` dovrebbe essere dichiarato e inizializzato a 0.
|
||||
|
||||
```js
|
||||
assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
|
||||
assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
|
||||
```
|
||||
|
||||
`total` dovrebbe essere uguale a 20.
|
||||
@@ -42,13 +42,13 @@ assert(total === 20);
|
||||
Dovresti usare un ciclo `for` per iterare attraverso `myArr`.
|
||||
|
||||
```js
|
||||
assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code));
|
||||
assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Non dovresti tentare di assegnare direttamente il valore 20 a `total`.
|
||||
|
||||
```js
|
||||
assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
|
||||
assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -56,7 +56,7 @@ Cambia il ciclo `while` nel codice con un ciclo `do...while` in modo che il cicl
|
||||
Dovresti usare un ciclo `do...while` per questo esercizio.
|
||||
|
||||
```js
|
||||
assert(code.match(/do/g));
|
||||
assert(__helpers.removeJSComments(code).match(/do/g));
|
||||
```
|
||||
|
||||
`myArray` dovrebbe essere uguale a `[10]`.
|
||||
|
||||
@@ -44,7 +44,7 @@ Usa un ciclo `for` per inserire i valori da 1 a 5 in `myArray`.
|
||||
Dovresti usare un ciclo `for`.
|
||||
|
||||
```js
|
||||
assert(/for\s*\([^)]+?\)/.test(code));
|
||||
assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`myArray` dovrebbe essere uguale a `[1, 2, 3, 4, 5]`.
|
||||
|
||||
@@ -36,7 +36,7 @@ Aggiungi i numeri da 5 a 0 (inclusi) in ordine decrescente a `myArray` utilizzan
|
||||
Dovresti usare un ciclo `while`.
|
||||
|
||||
```js
|
||||
assert(code.match(/while/g));
|
||||
assert(__helpers.removeJSComments(code).match(/while/g));
|
||||
```
|
||||
|
||||
`myArray` dovrebbe essere uguale a `[5, 4, 3, 2, 1, 0]`.
|
||||
|
||||
@@ -48,7 +48,7 @@ Dovresti aggiungere una variabile locale `myVar`.
|
||||
```js
|
||||
assert(
|
||||
/functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test(
|
||||
__helpers.removeWhiteSpace(code)
|
||||
__helpers.removeWhiteSpace(__helpers.removeJSComments(code))
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ assert(
|
||||
Dovresti usare `pop()` su `myArray`.
|
||||
|
||||
```js
|
||||
assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
|
||||
assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`removedFromMyArray` dovrebbe contenere solo `["cat", 2]`.
|
||||
|
||||
@@ -52,7 +52,7 @@ Dovresti usare l'indice corretto per modificare il valore in `myArray`.
|
||||
```js
|
||||
assert(
|
||||
(function () {
|
||||
if (code.match(/myArray\[0\]\s*=\s*/g)) {
|
||||
if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High');
|
||||
Non dovresti usare alcuna dichiarazione `if` o `else`
|
||||
|
||||
```js
|
||||
assert(!/else/g.test(code) || !/if/g.test(code));
|
||||
assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti avere nove dichiarazioni `case`
|
||||
|
||||
```js
|
||||
assert(code.match(/case/g).length === 9);
|
||||
assert(__helpers.removeJSComments(code).match(/case/g).length === 9);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -28,7 +28,7 @@ assert(product === 5.0);
|
||||
Dovresti usare l'operatore `*`
|
||||
|
||||
```js
|
||||
assert(/\*/.test(code));
|
||||
assert(/\*/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -36,7 +36,7 @@ assert(product === 80);
|
||||
Dovresti usare l'operatore `*`.
|
||||
|
||||
```js
|
||||
assert(/\*/.test(code));
|
||||
assert(/\*/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -60,7 +60,7 @@ Dovresti chiamare `functionWithArgs` con due numeri dopo averla definita.
|
||||
```js
|
||||
assert(
|
||||
/functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test(
|
||||
code.replace(/\s/g, '')
|
||||
__helpers.removeJSComments(code).replace(/\s/g, '')
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal');
|
||||
Dovresti usare l'operatore `===`
|
||||
|
||||
```js
|
||||
assert(code.match(/===/g));
|
||||
assert(__helpers.removeJSComments(code).match(/===/g));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -47,7 +47,7 @@ Dovresti rimuovere tutte le barre rovesciate (`\`).
|
||||
|
||||
```js
|
||||
assert(
|
||||
!/\\/g.test(code) &&
|
||||
!/\\/g.test(__helpers.removeJSComments(code)) &&
|
||||
myStr.match(
|
||||
'\\s*<a href\\s*=\\s*"http://www.example.com"\\s*target\\s*=\\s*"_blank">\\s*Link\\s*</a>\\s*'
|
||||
)
|
||||
@@ -57,7 +57,7 @@ assert(
|
||||
Dovresti avere due virgolette singole `'` e quattro virgolette doppie `"`.
|
||||
|
||||
```js
|
||||
assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
|
||||
assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -66,7 +66,7 @@ Il tuo codice non deve fare affidamento su alcun tipo di ciclo (`for` o `while`
|
||||
|
||||
```js
|
||||
assert(
|
||||
!code.match(/for|while|forEach|map|filter|reduce/g)
|
||||
!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g)
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -45,19 +45,19 @@ Cambiare le istruzioni `if`/`else if` concatenate con un'istruzione `switch`.
|
||||
Non dovresti usare nessuna istruzione `else` nell'editor
|
||||
|
||||
```js
|
||||
assert(!/else/g.test(code));
|
||||
assert(!/else/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Non dovresti usare nessuna istruzione `if` nell'editor
|
||||
|
||||
```js
|
||||
assert(!/if/g.test(code));
|
||||
assert(!/if/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti avere almeno quattro istruzioni `break`
|
||||
|
||||
```js
|
||||
assert(code.match(/break/g).length >= 4);
|
||||
assert(__helpers.removeJSComments(code).match(/break/g).length >= 4);
|
||||
```
|
||||
|
||||
`chainToSwitch("bob")` dovrebbe restituire la stringa `Marley`
|
||||
|
||||
@@ -52,7 +52,7 @@ assert(isLess(15, 10) === false);
|
||||
Non dovresti usare alcuna dichiarazione `if` o `else`
|
||||
|
||||
```js
|
||||
assert(!/if|else/g.test(code));
|
||||
assert(!/if|else/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta');
|
||||
Non dovresti usare alcuna dichiarazione `if` o `else`
|
||||
|
||||
```js
|
||||
assert(!/else/g.test(code) || !/if/g.test(code));
|
||||
assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
Dovresti avere almeno 3 istruzioni `break`
|
||||
|
||||
```js
|
||||
assert(code.match(/break/g).length > 2);
|
||||
assert(__helpers.removeJSComments(code).match(/break/g).length > 2);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -35,7 +35,7 @@ Assegna il valore `7` alla variabile `a`.
|
||||
Non modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(/var a;/.test(code));
|
||||
assert(/var a;/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`a` dovrebbe avere un valore di 7.
|
||||
|
||||
@@ -35,7 +35,7 @@ assert(difference === 12);
|
||||
Devi solo sottrarre un numero da `45`.
|
||||
|
||||
```js
|
||||
assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));
|
||||
assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -40,7 +40,7 @@ assert(myStr === 'Hello World');
|
||||
Non modificare il codice sopra il commento specificato.
|
||||
|
||||
```js
|
||||
assert(/myStr = "Jello World"/.test(code));
|
||||
assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
|
||||
`studlyCapVar` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione.
|
||||
|
||||
```js
|
||||
assert(code.match(/studlyCapVar/g).length === 2);
|
||||
assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2);
|
||||
```
|
||||
|
||||
`properCamelCase` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione.
|
||||
|
||||
```js
|
||||
assert(code.match(/properCamelCase/g).length === 2);
|
||||
assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2);
|
||||
```
|
||||
|
||||
`titleCaseOver` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione.
|
||||
|
||||
```js
|
||||
assert(code.match(/titleCaseOver/g).length === 2);
|
||||
assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,9 +39,9 @@ Non modificare il codice sotto il commento specificato.
|
||||
|
||||
```js
|
||||
assert(
|
||||
/a = a \+ 1;/.test(code) &&
|
||||
/b = b \+ 5;/.test(code) &&
|
||||
/c = c \+ " String!";/.test(code)
|
||||
/a = a \+ 1;/.test(__helpers.removeJSComments(code)) &&
|
||||
/b = b \+ 5;/.test(__helpers.removeJSComments(code)) &&
|
||||
/c = c \+ " String!";/.test(__helpers.removeJSComments(code))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name));
|
||||
Non dovresti modificare la definizione di `myDog`.
|
||||
|
||||
```js
|
||||
assert(/"name": "Coder"/.test(code));
|
||||
assert(/"name": "Coder"/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L');
|
||||
Dovresti usare la notazione a parentesi.
|
||||
|
||||
```js
|
||||
assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/));
|
||||
assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e');
|
||||
Dovresti usare `.length` per ottenere l'ultima lettera.
|
||||
|
||||
```js
|
||||
assert(code.match(/\.length/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v');
|
||||
Dovresti usare la notazione a parentesi.
|
||||
|
||||
```js
|
||||
assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/));
|
||||
assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c');
|
||||
Dovresti usare `.length` per ottenere la penultima lettera.
|
||||
|
||||
```js
|
||||
assert(code.match(/\.length/g).length > 0);
|
||||
assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@@ -54,7 +54,7 @@ Nella funzione `checkSign` utilizza più operatori condizionali - seguendo il fo
|
||||
`checkSign` dovrebbe utilizzare più operatori condizionali
|
||||
|
||||
```js
|
||||
assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
|
||||
assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`checkSign(10)` dovrebbe restituire la stringa `positive`. Nota che la capitalizzazione conta
|
||||
|
||||
@@ -59,7 +59,7 @@ Il tuo codice non dovrebbe basarsi su alcun tipo di ciclo (`for`, `while`o funzi
|
||||
|
||||
```js
|
||||
assert(
|
||||
!code.match(/for|while|forEach|map|filter|reduce/g)
|
||||
!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g)
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Il codice non dovrebbe utilizzare alcun ciclo (`for` o `while` o funzioni di ord
|
||||
|
||||
```js
|
||||
assert(
|
||||
!code.match(/for|while|forEach|map|filter|reduce/g)
|
||||
!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g)
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Utilizzare l'operatore condizionale nella funzione `checkEqual` per verificare s
|
||||
`checkEqual` dovrebbe utilizzare l'operatore condizionale
|
||||
|
||||
```js
|
||||
assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code));
|
||||
assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`checkEqual(1, 2)` dovrebbe restituire la stringa `Not Equal`
|
||||
|
||||
@@ -34,7 +34,7 @@ Usa `parseInt()` nella funzione `convertToInteger` in modo che converta un numer
|
||||
`convertToInteger` dovrebbe utilizzare la funzione `parseInt()`
|
||||
|
||||
```js
|
||||
assert(/parseInt/g.test(code));
|
||||
assert(/parseInt/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`convertToInteger("10011")` dovrebbe restituire un numero
|
||||
|
||||
@@ -26,7 +26,7 @@ Usa `parseInt()` nella funzione `convertToInteger` in modo che converta la serie
|
||||
`convertToInteger` dovrebbe utilizzare la funzione `parseInt()`
|
||||
|
||||
```js
|
||||
assert(/parseInt/g.test(code));
|
||||
assert(/parseInt/g.test(__helpers.removeJSComments(code)));
|
||||
```
|
||||
|
||||
`convertToInteger("56")` dovrebbe restituire un numero
|
||||
|
||||
@@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined');
|
||||
Non dovresti modificare l'istruzione `return`
|
||||
|
||||
```js
|
||||
assert(code.match(/return\sresult;/));
|
||||
assert(__helpers.removeJSComments(code).match(/return\sresult;/));
|
||||
```
|
||||
|
||||
Non dovresti usare le istruzioni `case`, `switch`o `if`
|
||||
|
||||
```js
|
||||
assert(
|
||||
!/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, ''))
|
||||
!/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, ''))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ assert(
|
||||
Non dovresti usare direttamente i valori `dog`, `ran`, `big` o `quickly` per creare `wordBlanks`.
|
||||
|
||||
```js
|
||||
const newCode = removeAssignments(code);
|
||||
const newCode = removeAssignments(__helpers.removeJSComments(code));
|
||||
assert(
|
||||
!/dog/.test(newCode) &&
|
||||
!/ran/.test(newCode) &&
|
||||
|
||||
@@ -50,7 +50,7 @@ Dovresti chiamare `reusableFunction` dopo averla definita.
|
||||
|
||||
```js
|
||||
const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString());
|
||||
const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, '');
|
||||
const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, '');
|
||||
assert(/reusableFunction\(\)/.test(codeWithoutFunction));
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user