* 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>
1.3 KiB
1.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244ac | 数字递增 | 1 | https://scrimba.com/c/ca8GLT9 | 18201 | increment-a-number-with-javascript |
--description--
使用++
,我们可以很容易地对变量进行自增或者+1
运算。
i++;
等效于
i = i + 1;
注意
i++;
这种写法,省去了书写=
符号的必要。
--instructions--
重写代码,使用++
来对变量myVar
进行自增操作。
提示
了解更多关于++
运算符Arithmetic operators - Increment (++).
--hints--
myVar
应该等于88
。
assert(myVar === 88);
myVar = myVar + 1;
语句应该被修改。
assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*myVar\+\+;/.test(code));
使用++
运算符。
assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
不要修改注释上方的代码。
assert(/var myVar = 87;/.test(code));
--seed--
--after-user-code--
(function(z){return 'myVar = ' + z;})(myVar);
--seed-contents--
var myVar = 87;
// Only change code below this line
myVar = myVar + 1;
--solutions--
var myVar = 87;
myVar++;