* chore(i18n,curriculum): update translations * chore: Italian to italian Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| bd7123c9c448eddfaeb5bdef | Trovare la lunghezza di una stringa | 1 | https://scrimba.com/c/cvmqEAd | 18182 | find-the-length-of-a-string |
--description--
Puoi trovare la lunghezza di un valore String scrivendo .length dopo la variabile stringa o il stringa letterale.
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.
--instructions--
Usa la proprietà .length per contare il numero di caratteri nella variabile lastName e assegnarla a lastNameLength.
--hints--
Non dovresti cambiare le dichiarazioni della variabile nella sezione // Setup.
assert(
code.match(/var lastNameLength = 0;/) &&
code.match(/var lastName = "Lovelace";/)
);
lastNameLength dovrebbe essere uguale a 8.
assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
Dovresti ottenere la lunghezza di lastName utilizzando .length in questo modo: lastName.length.
assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
--seed--
--seed-contents--
// Setup
var lastNameLength = 0;
var lastName = "Lovelace";
// Only change code below this line
lastNameLength = lastName;
--solutions--
var lastNameLength = 0;
var lastName = "Lovelace";
lastNameLength = lastName.length;