Assigning the Value of One Variable to Another

Tell us what’s happening:
I am stuck, when I run my code I am getting msg : a should be assigned to b with=. I am pretty sure that is what I’ve done or am I missing something

Your code so far

// Setup
var a;
a = 7;
var b;

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

Your browser information:

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

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

you have too many lines, you need only one line doing this:

Assign the contents of a to variable b .

also remember that the assignment happens from right to left

yo dont need b=7 line

I had a = b; only as my first answer but then I got this when I run the test
b should have a value of 7.
a should be assigned to b with =.
That is why I added the b = 7; line

you have assigned b to a

Thank you, It was the right to left issue

You are doing it wrong . you are assigning b to a not a to b . The answer is this b = a;

1 Like

Thanks Ericus,
I was reading the above comments, but your answer, provided the correct solution.

1 Like