+=
运算符一样, -=
从变量中减去一个数字。 myVar = myVar - 5;
将从myVar
减去5
。这可以改写为: myVar -= 5;
a
, b
和c
的赋值以使用-=
运算符。 a
应该等于5
testString: 'assert(a === 5, "a
should equal 5
");'
- text: b
应该等于-6
testString: 'assert(b === -6, "b
should equal -6
");'
- text: c
应该等于2
testString: 'assert(c === 2, "c
should equal 2
");'
- text: 您应该为每个变量使用-=
运算符
testString: 'assert(code.match(/-=/g).length === 3, "You should use the -=
operator for each variable");'
- text: 不要修改行上方的代码
testString: 'assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), "Do not modify the code above the line");'
```