freeCodeCamp/curriculum/challenges/spanish/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.spanish.md

68 lines
1.2 KiB
Markdown
Raw Normal View History

2018-10-08 13:34:43 -04:00
---
id: 56533eb9ac21ba0edf2244a9
title: Initializing Variables with the Assignment Operator
localeTitle: Inicializando variables con el operador de asignación
challengeType: 1
---
## Description
<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>
## Instructions
<section id='instructions'>
Defina una variable <code>a</code> con <code>var</code> e inicialícela a un valor de <code>9</code> .
</section>
## 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
var a = 9;
```
</section>