2018-10-08 13:34:43 -04:00
---
id: 56533eb9ac21ba0edf2244a9
title: Initializing Variables with the Assignment Operator
challengeType: 1
2018-10-10 16:20:40 -04:00
videoUrl: ''
localeTitle: Inicializando variables con el operador de asignación
2018-10-08 13:34:43 -04:00
---
## Description
2018-10-10 16:20:40 -04:00
< section id = "description" > Es común < dfn > inicializar< / dfn > una variable a un valor inicial en la misma línea que se declara. < code > var myVar = 0;< / code > Crea una nueva variable llamada < code > myVar< / code > y le asigna un valor inicial de < code > 0< / code > . < / section >
2018-10-08 13:34:43 -04:00
## Instructions
2018-10-10 16:20:40 -04:00
< section id = "instructions" > Defina una variable < code > a< / code > con < code > var< / code > e inicialícela a un valor de < code > 9< / code > . < / section >
2018-10-08 13:34:43 -04:00
## Tests
< section id = 'tests' >
```yml
tests:
- text: Inicializar < code > a</ code > a un valor de < 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
2018-10-10 16:20:40 -04:00
// solution required
2018-10-08 13:34:43 -04:00
```
< / section >