mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-08 12:04:29 -05:00
1.6 KiB
1.6 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| 56533eb9ac21ba0edf2244ba | Розуміння нестійкості рядка | 1 | https://scrimba.com/c/cWPVaUR | 18331 | understand-string-immutability |
--description--
У JavaScript, String значення immutable, означає, що їх не можна буде змінити після створення.
For example, the following code will produce an error because the letter B in the string Bob cannot be changed to the letter J:
let myStr = "Bob";
myStr[0] = "J";
Note that this does not mean that myStr could not be re-assigned. The only way to change myStr would be to assign it with a new value, like this:
let myStr = "Bob";
myStr = "Job";
--instructions--
Виправте призначення myStr так, щоб код містив рядок зі значенням Hello World, використовуючи підхід, показаний вище.
--hints--
myStr має мати значення рядка Hello World.
assert(myStr === 'Hello World');
Не змінюйте код над зазначеним коментарем.
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";