How to assign a to b

Tell us what’s happening:

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 (Linux; Android 9; TECNO CC7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Mobile Safari/537.36.

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

Hi @antipasgoodluck !

Welcome to the forum!

I would suggest resetting the lesson because you are supposed to write your code where it says

Also you should not change anything in the setup.
All of this should be deleted

Now that you have reset the lesson here is how variables work.
Your task is to assign a to variable b using the assignment operator.

This is the assignment operator =

In programming, that is not the equals sign. It is important to remember that.
Equals in programming would be this == or strictly equals ===
You will learn about the equality operator in later lessons.

What is on the right hand side of the assignment operator = will be assigned to what is on the left.

For example, if I had a variable called dog and I wanted to assign the name Spike to it this is how you would do it.

//variable declaration
var dog;
//assigning spike to the variable of dog
dog = "Spike"

You are going to use that same logic and assign a to variable b.
You do not need to declare any new variables. All of that has been provided for you.
Your solution should only be one line.
Hope that makes sense.

2 Likes

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