mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 21:03:58 -05:00
1020 B
1020 B
id, title, challengeType, videoUrl, forumTopicId
| id | title | challengeType | videoUrl | forumTopicId |
|---|---|---|---|---|
| 56533eb9ac21ba0edf2244ac | 数字递增 | 1 | https://scrimba.com/c/ca8GLT9 | 18201 |
--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));