Basic JavaScript - Assigning the Value of One Variable to Another

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

Your code so far

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

// Only change code below this line

Your browser information:

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

Challenge: Basic JavaScript - Assigning the Value of One Variable to Another

Link to the challenge:

Hi! Welcome to the forum!

Please try to describe your issue in more detail in the ‘tell us what is happening’ section in future, you can write your own text in this section. It makes helping much easier.

Now, look at this bit of your code.

var ab;

You declared a new variable, ab. Read the instructions carefully, does the example code or lesson say to declare a new variable?

Note that your code can pass without changing this, but that extra code may not be doing what you think it is.

Hey! it would be much easier for others to help you if you add a brief description of the problem you’re facing.

and in this particular problem, you’re supposed to assign a to b and not the other way around.

In programming, variable assignment is done from right to left.

// you can read it as, taking the value of y
// and putting into the variable x
// or assigning the value of y to x.

x = y

Hope this helps! :smile: