--
运算符轻松地将变量减1或减1。 i--;
相当于i = i - 1;
注意 i--;
,消除了对等号的需要。 myVar
上使用--
运算符。 myVar
应该等于10
testString: 'assert(myVar === 10, "myVar
should equal 10
");'
- text: myVar = myVar - 1;
应该改变
testString: 'assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code), "myVar = myVar - 1;
should be changed");'
- text: 在myVar
上使用--
运算符
testString: 'assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code), "Use the --
operator on myVar
");'
- text: 不要更改行上方的代码
testString: 'assert(/var myVar = 11;/.test(code), "Do not change code above the line");'
```