Basic JavaScript - Assigning the Value of One Variable to Another

Tell us what’s happening:
Describe your issue in detail here.
How do i do this?
Your code so far

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

// Only change code below this line
var b;
b = 7; // The variable 'b' is equal to 7

var abc;
abc = a; // The variable 'abc' is equal to 7

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

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

Link to the challenge:

Could you explain what’s the problem please?

You’ve changed the ‘setup’ code which confuses things a little.
It should be:

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

This declares two variables (a and b) and assigns the value 7 to variable a.

The challenge then asks you to:

Assign the contents of a to variable b .

The example given in the challenge shows you exactly how to do this.

Its still not working

Tell us what’s happening:
Describe your issue in detail here.
a should be assigned to b with
Your code so far

var a;
a = 7; // The variable 'a' is equal to 7

var b;
b = 7; // The variable 'b' is equal to 7

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

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

Link to the challenge:

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!


Your code only works if a happens to have 7 as it’s value. It should work no matter what is stored inside of a

It keeps saying
a should be assigned to b with
How do i fix it

You should us = to put the value stored in a into b instead of putting the value 7 into b

So put a = b
Then test it

That puts the value of b into a. That’s the opposite of what you are supposed to do

You haven’t followed the instructions exactly.

How do i do that?
This is what i have right now

var a;
a = 7;
var b;
// Only change code below this line
var a;
a = 7; // The variable 'a' is equal to 7
var b;
b = 7; // The variable 'b' is equal to 7```

You went back to directly putting 7 into b. Do not do this.

You need one line line this

But not backwards

thanks so much for helping me!