Java script problem solution

i don’t know how to assign the contents to a to b

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

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


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

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

Your browser information:

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

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

You should not re-declare a.

You also should not set the value of b to be the number that you happen to know a holds. You should instead assign the contents of a into b.

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

The above declares a myVar variable with no value, then assigns it the value 5 . Next, a variable named myNum is declared with no value. Then, the contents of myVar (which is 5 ) is assigned to the variable myNum . Now, myNum also has the value of 5 .

1 Like

I am still confused on what you mean. I have assigned the variable a to b but the test is still not successful

What is your new code?

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