var z; //Declaring a variable z without assigning any value. console.log(z); //Outputs 'undefined'.
If you try to assign a variable that is undefined, and then try to use it, it will result in an error.
var a; console.log(a); //Outputs 'undefined'. a = a + 10; //This will result in an error.
In the above code snippet, variable a is declared without assigning any value. When we try to use it, it will return undefined. If we try to assign a value to it and use it in an expression, we will get an error because undefined cannot be used in any arithmetic operation.