Earlier, we declared a variable with a value like this.
var x = 10;
We can also declare a variable without assigning a value.
Try running this in the editor:
var x; console.log(x);
In this case, the value of the variable is
Now try this:
var x = 5; console.log(x);
This time we see
5 because that is the value of
Assigning Empty Variables
If we declare a variable without a value, we can still assign it a value later:
var x; x = 9; console.log(x);