Having troubles with Storing Values with the Assignment Operator

Tell us what’s happening:

I have a syntax error… Not sure what I’m doing wrong!

Your code so far


// Setup
var a;
var b = 2;

// Only change code below this line

var a = 7;
var b = 7;
var a = var b;

Your browser information:

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

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

I have to:
Assign the value 7 to variable a .
Assign the contents of a to variable b .

You were very close! When assigning or even reassigning a value to an already established variable, you just need to use the name of the variable:

// Setup
var a;
var b = 2;

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

So going by the exercise’s directions, since var a and b are already established (though a doesn’t have a value as of yet) in the // Setup area, we only need to tell it a equals 7 and b should equal the value of whatever’s in a (which we’ve just set to 7). Hope that makes sense.