Basic JavaScript - Assigning the Value of One Variable to Another

Tell us what’s happening:

Describe your issue in detail here.

Hi Guys,

I am at the very beginning of my coding journey and I am struggling to get past one of the first lessons, can someone assist me in telling me what I am doing wrong, as you can see that is my input code on the right hand side

Thankyou

Your code so far

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

// Only change code below this line
var a;
a = 7;
var b;
b = 7 
var a = var 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/119.0.0.0 Safari/537.36

Challenge Information:

Basic JavaScript - Assigning the Value of One Variable to Another

Welcome to the community @kjb1992 !

Is the instruction to assign the variable b to variable a, or the other way around?

Currently variable b is assigned to variable a.

I hope this helps you.

Happy coding!

You shouldnt be using var any where under the “change code below this line” var is already used up top to define the variables. You should only be using a and b not var

Here is the example from the lesson.

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

Notice how myVar is assigned to myNum in the example.

Hopefully this will help you move on.

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