Question: Why am I able to write:

```
var x = 5;
console.log(x);
5

```

but when I write:

```
var n = a;
console.log(n);
Uncaught ReferenceError: a is not defined

```

Answer: 
Well, you don't have a variable `a`. Set it beforehand, like this:

```
var a = 10;
var n = a;  // n is now also 10

```

If you want a character string, enclose the characters in quotes:

```
var n = "a";  // n is now a character string, not a number

```
Because you are trying to print out put of `n` which reference value of `a` which is undefined variable. 

You are getting error instead of undefined because javascript does not allow you assignment of undeclared variable