mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-16 18:07:45 -05:00
* chore(i18n,learn): processed translations * Update Ukrainian file to match state on crowdin Co-authored-by: Ilenia <nethleen@gmail.com>
1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| 56533eb9ac21ba0edf2244ba | Comprendere l'immutabilità delle stringhe | 1 | https://scrimba.com/c/cWPVaUR | 18331 | understand-string-immutability |
--description--
In JavaScript, le stringhe (String) sono immutabili, il che significa che non possono essere modificate una volta create.
Ad esempio, il seguente codice produrrà un errore perché la lettera B nella stringa Bob non può essere cambiata nella lettera J:
let myStr = "Bob";
myStr[0] = "J";
Nota che ciò non significa che myStr non può essere riassegnata. L'unico modo per cambiare myStr è assegnarle un nuovo valore, in questo modo:
let myStr = "Bob";
myStr = "Job";
--instructions--
Correggi l'assegnazione a myStr in modo che contenga il valore stringa di Hello World utilizzando l'approccio mostrato nell'esempio sopra.
--hints--
myStr dovrebbe avere un valore stringa Hello World.
assert(myStr === 'Hello World');
Non modificare il codice sopra il commento specificato.
assert(/myStr = "Jello World"/.test(code));
--seed--
--after-user-code--
(function(v){return "myStr = " + v;})(myStr);
--seed-contents--
// Setup
let myStr = "Jello World";
// Only change code below this line
myStr[0] = "H"; // Change this line
// Only change code above this line
--solutions--
let myStr = "Jello World";
myStr = "Hello World";