Assignment Operator and values

Tell us what’s happening:
Hi

I am lost not sure what they mean by
Assign the contents of a to variable b
a = b is clearly wrong but I am stuck
= is the way of assigning Eh?

Your code so far



// Setup
var a;
var b = 2;

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15.

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

a = 7 assigns 7 to a.
b = a assigns the value of a to b, which is what it’s asking for.
Then you have a = b which assigns the value of b to a. The challenge doesn’t ask for this. They’re already they same value, anyway.

edit: Oh, you’re missing semicolons.

1 Like