--- id: 56533eb9ac21ba0edf2244a9 challengeType: 1 videoUrl: 'https://scrimba.com/c/cWJ4Bfb' forumTopicId: 301171 title: 使用赋值运算符初始化变量 --- ## Description
通常在声明变量的时候会给变量初始化一个初始值。 var myVar = 0; 创建一个名为myVar的变量并指定一个初始值0
## Instructions
通过关键字var定义一个变量a并且给它一个初始值9
## Tests
```yml tests: - text: 你需要初始化a的值为9。 testString: assert(/var\s+a\s*=\s*9\s*/.test(code)); ```
## Challenge Seed
```js // Example var ourVar = 19; // Only change code below this line ```
### After Test
```js if(typeof a !== 'undefined') {(function(a){return "a = " + a;})(a);} else { (function() {return 'a is undefined';})(); } ```
## Solution
```js var a = 9; ```