Storing Values with the Assignment Operatorss

Storing Values with the Assignment Operatorss
0

#1

Tell us what’s happening:

Your code so far


// Setup
var a;
var b = 2;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator


#2

You are not following the instructions. First, the variables have already been declared, so do not use var in front of them or use an other var reference.
You have correctly assigned the value 7 to a, but then for some reason you assign the value 7 to be. The instructions state to assign the contents of a to b.

This challenge is solved using only 2 lines. You will have the first one correct once you remove the var.

When you assign one variable to another, the variable on the left of the = operator is the one being assigned the value and the variable on the right of the = operator is the value which will be assigned to the other variable.

For example, the following has two variables x and y. If I want to assign the value of y to x, I would write:

x = y;