Storing Values with the Assignment Operator plz help

Storing Values with the Assignment Operator plz help
0.0 0

#1

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:


#2

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!


#3

Doesn’t work
but thanks anyway


#4

Can you paste your current code?


#5

look up its in the name


#6

i mean in the title …


#7

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.


#8

@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.


#10

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.


#11

// Setup
var a;
var b = 2;

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


#12

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


#13

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


#14

yeah, thanks …