The Undefined type only has the value - undefined. A variable is only assigned the value undefined when a variable is created but not initialized. A variable can also be initialised with the value undefined, however, this is not required and is not a good practice.
var result; // not initialised alert(typeof result); // undefined var result2 = undefined; alert(typeof result2); // undefined alert(typeof result3); // undefined - result3 variable does not exist
The Undefined type cannot be used for any valid operations except for calling the typeof operator. As shown in the examples above, calling typeof on an uninitialised variable will return "undefined".
alert(typeof result3); // undefined - result3 variable not declared
Note: it is recommended to always initialise a variable to avoid any failures when using the variable.