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.5 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244b7 用加号运算符连接字符串 1 https://scrimba.com/c/cNpM8AN 16802 concatenating-strings-with-plus-operator

--description--

在 JavaScript 中,当对一个String类型的值使用+操作符的时候,它被称作 拼接操作符。你可以通过拼接其他字符串来创建一个新的字符串。

示例

'My name is Alan,' + ' I concatenate.'

提示
注意空格。拼接操作不会在两个字符串之间添加空格,所以想加上空格的话,你需要自己在字符串里面添加。

--instructions--

使用+操作符,把字符串"This is the start. ""This is the end."连接起来并赋值给变量myStr

--hints--

myStr的值应该是This is the start. This is the end.

assert(myStr === 'This is the start. This is the end.');

使用+操作符构建myStr

assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1);

myStr应该被var关键字声明。

assert(/var\s+myStr/.test(code));

确保有给myStr赋值。

assert(/myStr\s*=/.test(code));

--seed--

--after-user-code--

(function(){
  if(typeof myStr === 'string') {
    return 'myStr = "' + myStr + '"';
  } else {
    return 'myStr is not a string';
  }
})();

--seed-contents--

var myStr; // Change this line

--solutions--

var myStr = "This is the start. " + "This is the end.";