Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1.3 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 中,字符串的值是 不可变的,这意味着一旦字符串被创建就不能被改变。

例如,下面的代码:

var myStr = "Bob";
myStr[0] = "J";

是不会把变量myStr的值改变成 "Job" 的,因为变量myStr是不可变的。注意,这并不意味着myStr永远不能被改变,只是字符串字面量 string literal 的各个字符不能被改变。改变myStr中的唯一方法是重新给它赋一个值,例如:

var myStr = "Bob";
myStr = "Job";

--instructions--

myStr的值改为Hello World

--hints--

message: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
var myStr = "Jello World";

// Only change code below this line
myStr[0] = "H"; // Change this line
// Only change code above this line

--solutions--

var myStr = "Jello World";
myStr = "Hello World";