mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-15 06:07:34 -05:00
* chore(i18n,learn): processed translations * Update Ukrainian file to match state on crowdin Co-authored-by: Ilenia <nethleen@gmail.com>
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 の値はイミュータブルです。つまり、作成後に変更することはできません。
たとえば次のコードは、文字列 Bob 内の文字 B を文字 J に変更できないため、エラーが発生します。
let myStr = "Bob";
myStr[0] = "J";
ただし、これは myStr に再代入できないという意味ではありません。 myStr を変更する唯一の方法は、次のように新しい値を代入することです。
let myStr = "Bob";
myStr = "Job";
--instructions--
上の例で説明したアプローチに従って、文字列 Hello World を値として含むよう、myStr への代入を修正してください。
--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";