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