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;

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

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

Link to the challenge:

hello, welcome to the forum!
We see you posted some code. Did you have a question?

Look at the example code. If we also add the comments from the editor code it would look like this.

// Setup
var myVar;
myVar = 5;
var myNum;

// Only change code below this line
myNum = myVar;

myVar contains 5 and the contents of myVar is assigned to the variable myNum.

Here is the challenge starting code

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

// Only change code below this line

a contains 7 now assign a to b (“a to b” is written in code as “b receives a” with “receives” being the = symbol)

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