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; // the variable a is equal to 7
var b;

// Only change code below this line
var a = var b ; //The varialbe b is equal to 7

Your browser information:

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

Challenge Information:

Basic JavaScript - Assigning the Value of One Variable to Another

Set the value of b to the current value of a , which is 7. There’s no need to use the var keyword again when assigning the value of one variable to another.

1 Like

There is no need to declare the variable a twice

var b =c;
var d= b;

the code above will initialize the value of d to be equal to c.Hope this helps

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