Storing Values with the Assignment Operator plz help

Tell us what’s happening:

So I assigned A = B
and it still gives me the error that I have to assign a to b
wtf

Your code so far

// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;
var bNum = 5;
var b = (bNum + b);
var a = b;

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/storing-values-with-the-assignment-operator

Hi R4D,

I think the instructions may be a little confusing. What they want you to do is:

a = 7;
b = a;

Note that you shouldn’t use “var” after the first declaration.

Hope this helps!

Doesn’t work
but thanks anyway

Can you paste your current code?

look up its in the name

i mean in the title …

Hello R4D,

Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.
Please check your code.

pwkrz gave the correct answer.

@pwkrz gave you the solution. If you are still having issues, please post all of challenge code (including your part) in a reply. No one can see your current code except you when working on the FCC challenges.

Not sure why you are creating the extra bNum variable. The challenge wants you to do two things and two things only.

1st- Assign the value 7 to variable a.

That is done by a = 7;

2nd - Assign the contents of a to variable b.

That is done by b = a;

That is all you needed to do to pass the challenge. You do not need extra variables. You do not need to declare a or b again, because they were already declared in the Setup section above your code.

If you have any further questions about anything I have written here, please let us know.

// Setup
var a;
var b = 2;

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

Thank you so much, ive spent 4 hours last night trying to fix.

The important thing is, do you understand why this is the correct solution?

yeah, thanks …