--- id: 56533eb9ac21ba0edf2244a8 title: Storing Values with the Assignment Operator challengeType: 1 videoUrl: 'https://scrimba.com/c/cEanysE' forumTopicId: 18310 --- ## Description
In JavaScript, you can store a value in a variable with the assignment operator (=). myVariable = 5; This assigns the Number value 5 to myVariable. If there are any calculations to the right of the = operator, those are performed before the value is assigned to the variable on the left of the operator. ```js var myVar; myVar = 5; ``` First, this code creates a variable named myVar. Then, the code assigns 5 to myVar. Now, if myVar appears again in the code, the program will treat it as if it is 5.
## Instructions
Assign the value 7 to variable a.
## Tests
```yml tests: - text: You should not change code above the specified comment. testString: assert(/var a;/.test(code)); - text: a should have a value of 7. testString: assert(typeof a === 'number' && a === 7); ```
## Challenge Seed
```js // Setup var a; // Only change code below this line ```
### Before Test
```js if (typeof a != 'undefined') { a = undefined; } ```
### After Test
```js (function(a){return "a = " + a;})(a); ```
## Solution
```js var a; a = 7; ```