--- id: 56533eb9ac21ba0edf2244aa title: Understanding Uninitialized Variables challengeType: 1 videoUrl: https://scrimba.com/c/cBa2JAL forumTopicId: 18335 localeTitle: Понимание неинициализированных переменных --- ## Description
Когда объявляются переменные JavaScript, они имеют начальное значение undefined . Если вы выполняете математическую операцию с undefined переменной, ваш результат будет NaN что означает «Not a Number» . Если вы конкатенируете строку с undefined переменной, вы получите буквенную строку "undefined" .
## Instructions
Инициализируйте три переменные a , b и c с 5 , 10 и "I am a" соответственно, чтобы они не были undefined .
## Tests
```yml tests: - text: a should be defined and evaluated to have the value of 6 testString: assert(typeof a === 'number' && a === 6); - text: b should be defined and evaluated to have the value of 15 testString: assert(typeof b === 'number' && b === 15); - text: c should not contain undefined and should have a value of "I am a String!" testString: assert(!/undefined/.test(c) && c === "I am a String!"); - text: Do not change code below the line testString: assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code)); ```
## Challenge Seed
```js // Initialize these three variables var a; var b; var c; // Do not change code below this line a = a + 1; b = b + 5; c = c + " String!"; ```
### After Tests
```js (function(a,b,c){ return "a = " + a + ", b = " + b + ", c = '" + c + "'"; })(a,b,c); ```
## Solution
```js var a = 5; var b = 10; var c = "I am a"; a = a + 1; b = b + 5; c = c + " String!"; ```