undefined
undefined β A variable which does not have itβs value defined.
Description
undefined
Examples
Example #1 β undefined
var a;
var b = undefined;
console.log(typeof a); // undefined
console.log(a); // undefined
console.log(typeof b); // undefined
console.log(b); // undefined
Example #2 β In some situations you might en up with the sting 'undefined'
When checking typeof an undefined variable, the result is a string.
var a;
console.log(a === undefined); // true
console.log(typeof a === undefined); // false
console.log(a === 'undefined'); // false
console.log(typeof a === 'undefined'); // true
External references