Menulearn to code javascript at Free Code Camp logo

Storing Values with the Assignment Operator
In JavaScript, you can store a value in a variable with the assignment operator.

myVariable = 5;

Assigns the Number value 5 to myVariable.

Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.

myVar = 5;
myNum = myVar;
Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.

Instructions
Assign the value 7 to variable a.

Assign the contents of a to variable b.

Run tests (ctrl + enter)
Reset Help Bug
/**
* Your output will go here.
* Any console.log() -type
* statements will appear in
* your browser’s DevTools
* JavaScript console as well.
*/

Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =

1

2
// Setup
3
var a;
4
var b = 7;
5
myVar = a ;
6
myNum = myVar;
7
a = 7 ;
8

9
// Only change code below this line
10

11

https://www.freecodecamp.com/challenges/storing-values-with-the-assignment-operator