---
id: 56533eb9ac21ba0edf2244a9
title: Initializing Variables with the Assignment Operator
challengeType: 1
videoUrl: ''
localeTitle: 使用赋值运算符初始化变量
---

## Description
<section id="description">通常将变量<dfn>初始化</dfn>为与声明的同一行中的初始值。 <code>var myVar = 0;</code>创建一个名为<code>myVar</code>的新变量，并为其指定初始值<code>0</code> 。 </section>

## Instructions
<section id="instructions">使用<code>var</code>定义变量<code>a</code>并将其初始化为值<code>9</code> 。 </section>

## Tests
<section id='tests'>

```yml
tests:
  - text: 将<code>a</code>初始化为值<code>9</code>
    testString: 'assert(/var\s+a\s*=\s*9\s*/.test(code), "Initialize <code>a</code> to a value of <code>9</code>");'

```

</section>

## Challenge Seed
<section id='challengeSeed'>

<div id='js-seed'>

```js
// Example
var ourVar = 19;

// Only change code below this line

```

</div>


### After Test
<div id='js-teardown'>

```js
console.info('after the test');
```

</div>

</section>

## Solution
<section id='solution'>

```js
// solution required
```
</section>
