I think i wrote correct but i am stuck


// 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/98.0.4758.102 Safari/537.36

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

The failing test says:

a should be assigned to b with = .

The relevant code is this:

a = b;

That is doing the opposite of what you want. The assignment operator (=) takes whatever the right side evaluates to (in other cases it could be a more complicated formula) and places it in the memory location on the left side.

What you have is saying, “assign b to a” or “take the contents of b and store it in a”. I think the “assign” terminology is a little obtuse, but it is what it is.

Does that help?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.