--- id: 56533eb9ac21ba0edf2244ad challengeType: 1 videoUrl: 'https://scrimba.com/c/cM2KeS2' forumTopicId: 17558 localeTitle: 数字递减 --- ## Description
使用自减符号--,你可以很方便地对一个变量执行自减或者-1运算。 i--; 等效于 i = i - 1; 提示
i--;这种写法,省去了书写=符号的必要。
## Instructions
重写代码,使用--符号对myVar执行自减操作。
## Tests
```yml tests: - text: myVar应该等于10。 testString: assert(myVar === 10); - text: myVar = myVar - 1;语句应该被修改。 testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)); - text: 对myVar使用--运算符。 testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); - text: 不要修改注释上面的代码。 testString: assert(/var myVar = 11;/.test(code)); ```
## Challenge Seed
```js var myVar = 11; // Only change code below this line myVar = myVar - 1; ```
### After Test
```js (function(z){return 'myVar = ' + z;})(myVar); ```
## Solution
```js var myVar = 11; myVar--; ```