Do you understand what the given sample code is doing?
var myVar;
myVar = 5;
var myNum;
myNum = myVar;
The starter code is
var a;
a = 7;
var b;
and the task is to assign the value of a to b. You wrote
b = 7;
The task is not to assign a fixed value 7 to b. The task is whatever the value of a is, assign that value to b.
What are you trying to achieve with this?
var ab;
Variables a and b are declared and a has a value assigned to it. You assign that value of a to b. Don’t add any unnecessary code. Study the sample code
We can assign a value 8 to a variable x like this.
var x = 8;
We can declare the variable first without assigning any value, and then assign a value to it like this.
var x;
x = 8;
The next code assigns a value of 8 to a variable x and then assigns a new value 12 to x.
let x = 8;
x = 12;
Can you write code to assign the value of 8 to a variable x and then assigns a new value of 20?
Now, consider the following code.
var y = 20;
var x;
x = y;
The value of y is 20. What do you think the value of x would be?
Specifically about your code.
var ab; //Don't declare a variable you don't assign
// any value to it. Just because there are
// variables a and b, declaring a new
// variable ab that combines variables a and b will
// not do anything. It won't magically create
// a new value that somehow adds two values
// or assigns one value to another.
// There's no Harry Potter around here.
b = 7 //Terminate statements with a semicolon like b = 7;