a = 7 so instead of writing b = 7 you have to use the a variable in the assignment … so b = a will works and that what they mean by assign a to b in the exercise
Hey @bluryboss
You are doing it the reverse way around.
b should have the value of 7, but you should not do b = 7;
Instead, notice how a already has been assigned the value 7 and use this to give b the same value.
Currently, you are assigning “a” the value of “b”. It wants you to assign “b” the value of “a”
I hope this makes sense?
You should not change code above the specified comment.
b should have a value of 7.
a should be assigned to b with =.
those are what the challenge will be testing for when you click “Run the tests”…
By assigning a to b , bwill have a value of 7 and will pass the tests on the left. That is the point the lesson is trying to illustrate to you.
also, something to know is…
If you assign a to b , and change the value of a later, the value of b will not change.
var a;
a = 7;
console.log("a is " + a)
var b;
b = a;
console.log("b is " + b)
a = 3;
console.log("a is " + a)
console.log("b is " + b)
Output:
a is 7
b is 7
a is 3
b is 7 // still 7
If you assign a to b, and change the value of b later, the value of a will not change.
var a;
a = 7;
console.log("a is " + a)
var b;
b = a;
console.log("b is " + b)
b = 3;
console.log("a is " + a)
console.log("b is " + b)
Output:
a is 7
b is 7
a is 7 // still 7
b is 3
The order of assignment and where things are assigned in the code makes a difference. Seems simple, but is an important concept to understand.