I dont understand the assignment operator

I dont understand the assignment operator
0

#1

Tell us what’s happening:
I am so lost what do I need to do to make this code work?

Your code so far

// Setup
var a;
var b = 2;

// Only change code below this line
myVariable = 7;
var a = 7;
var b = 7;
myVar = 7;
myNum = myVar;

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36.

Link to the challenge:


#2

You only have to do two things:

Assign the value 7 to variable a.
Assign the contents of a to variable b.

The assignment operator is just the =. Whatever is on the right gets assigned to the variable name on the left.

You do not need to use var here because that will create a new variable. The focus here is on assigning values to variables.


#3

The keyword var only needs to be used once: the first time that you declare your variable.

var myVariable = 1; // I have declared the variable myVariable and assigned the value 1 to it
myVariable = 42; // now the variable myVariable contains the value 42 instead of the value 1

#4

Awesome! Thank you, this really helped me get it!