1.3 KiB
1.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244ad | Decrementare un numero con JavaScript | 1 | https://scrimba.com/c/cM2KeS2 | 17558 | decrement-a-number-with-javascript |
--description--
Puoi facilmente decrementare o diminuire una variabile con l'operatore --
.
i--;
è equivalente a
i = i - 1;
Nota: L'intera linea diventa i--;
, eliminando la necessità di un segno uguale.
--instructions--
Cambia il codice per utilizzare l'operatore --
su myVar
.
--hints--
myVar
dovrebbe essere uguale a 10
.
assert(myVar === 10);
myVar = myVar - 1;
dovrebbe essere modificato.
assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/));
Non dovresti assegnare 10
a myVar
.
assert(!code.match(/myVar\s*=\s*10.*?;?/));
Dovresti usare l'operatore --
su myVar
.
assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
Non dovresti modificare il codice sopra il commento specificato.
assert(/let myVar = 11;/.test(code));
--seed--
--after-user-code--
(function(z){return 'myVar = ' + z;})(myVar);
--seed-contents--
let myVar = 11;
// Only change code below this line
myVar = myVar - 1;
--solutions--
let myVar = 11;
myVar--;