Wondering why I keep getting basic variable wrong

Tell us what’s happening:
Describe your issue in detail here.

I am being marked an incorrect for nat setting my variable an equal to my variable b but I followed all the steps

Your code so far

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

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS aarch64 14092.77.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.107 Safari/537.36

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

You’ve flipped the order of things here

Assign the contents of a to variable b .

You are assigning the contents of variable b (on the right) into the variable a (on the left).

1 Like

Hi @lindsay.schuler !

Welcome to the forum!

When you are learning about assignment for the first time it can be a little confusing.
And it is common to switch the order.

Maybe a visual might help with the understanding.

Our task, is to assign the contents of A to variable B.
Imagine, you had a box called B and you are pouring in the contents of A into the B box.

Hopefully that helps!

As said, it’s not an uncommon mistake.

But I would suggest thinking about which variable contains a value to be the correct way of identifying the assignment order.

Variable a contains the value 7. Variable b contains undefined. So assigning a
to b makes sense. But assigning b to a doesn’t.

Even if the challenge did not tell you what variable to assign to just knowing which variable contains a (proper) value should be enough to hint at the assignment order.

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