* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
1.4 KiB
1.4 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244ad | Decrement a Number with JavaScript | 1 | 使用JavaScript减少数字 |
Description
--
运算符轻松地将变量减1或减1。 i--;
相当于i = i - 1;
注意 整条线变成了
i--;
,消除了对等号的需要。 Instructions
myVar
上使用--
运算符。 Tests
tests:
- text: <code>myVar</code>应该等于<code>10</code>
testString: assert(myVar === 10);
- text: <code>myVar = myVar - 1;</code>应该改变
testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code));
- text: 在<code>myVar</code>上使用<code>--</code>运算符
testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
- text: 不要更改行上方的代码
testString: assert(/var myVar = 11;/.test(code));
Challenge Seed
var myVar = 11;
// Only change code below this line
myVar = myVar - 1;
After Test
console.info('after the test');
Solution
// solution required