Help on Java Script

Hello there.

Do you have a question?

If so, please edit your post to include your question and your current code.

The more information you give us, the more likely we are to be able to help.

1 Like

yes, I am struggling with the demand to make a=b

Can you please include your current code?

That’s because you are supposed to do the exact opposite :wink:
Propably missread the task.

var a;

a= 7;

var b;

b= 7;

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

You need to assign the contents of a into b, not the value that you happen to know was assigned to a.

I having trouble understanding, could you maybe give me a hint

You know the value in a is 7. Pretend that you don’t. How do you put the contents of a into b?

I am going to need a more information than that, because I do not know how to pretend that the value does not exist

Is there a part of the given example that confuses you?

var myVar;
myVar = 5;
var myNum;
myNum = myVar;

Nowhere in the example do they use their knowledge of the contents of the first variable to set the contents of the second.

I have been using your format for awhile now, yet nothing is working

var myVar;

myVar=7;

var b;

b= 7;

var myVar;

myVar = 7;

var myNum;

myNum=myVar;

If I tell you I have an unknown amount of money in a bag (variable a) and I tell you to put that unknown amount of money into another bag (variable b), without looking in the first bag, you could think of this as assigning the value of a to b. You don’t care about the actual value . You only need to assign the value.

There is no need to create any additional variables like you are doing with myVar and myNum. You will just use the variables a and b.

1 Like

That’s just the concept of. I just need to know how to exactly do it

Or show me the mistake I am making

To be clear, we won’t do it for you.


You shouldn’t copy the example code. You should make the code in the challenge work in a similar way as the code in the example.

In the example, the variable myVar is created. Then a value is assigned to this variable. Then the variable myNum is created. Then the contents of myVar are copied into myNum.

You need to do something similar in the challenge, with a and b.

1 Like

If you are to the point where you just want the answer, you can always click on the “Get a Hint” link under the “Get Help” for each challenge. We are trying to guide you to a solution instead of just telling you how to solve the challenge. You need to understand the concept.

2 Likes