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

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244a8 使用赋值运算符存储值 1 https://scrimba.com/c/cEanysE 18310 storing-values-with-the-assignment-operator

--description--

在 JavaScript 中,你可以使用赋值运算符将值存储在变量中。

myVariable = 5;

这条语句把Number类型的值5赋给变量myVariable

赋值过程是从右到左进行的。在将值分配给运算符左侧的变量之前,将解析=运算符右侧的所有内容。

myVar = 5;
myNum = myVar;

数值5被赋给变量myVar中,然后再次将变量myVar解析为5并将其赋给myNum变量。

--instructions--

把数值7赋给变量 a

把变量a中的内容赋给变量b

--hints--

不要修改注释上方的代码。

assert(/var a;/.test(code) && /var b = 2;/.test(code));

a的值应该是 7。

assert(typeof a === 'number' && a === 7);

b的值应该是 7。

assert(typeof b === 'number' && b === 7);

你需要用=a的值赋给b

assert(/b\s*=\s*a\s*;/g.test(code));

--seed--

--before-user-code--

if (typeof a != 'undefined') {
  a = undefined;
}

--after-user-code--

(function(a){return "a = " + a;})(a);

--seed-contents--

// Setup
var a;

// Only change code below this line

--solutions--

var a;
a = 7;