undefined

Contents

undefined#

undefined is the default value of an uninitialised binding, a missing function argument, a returnless function, and a property access on an absent key. typeof undefined is "undefined".

let x;
typeof x;             // "undefined"

A function that never returns yields undefined.

function noop() {}
noop();               // undefined

Missing properties read as undefined (no exception).

({}).missing;         // undefined

Prefer === undefined for explicit checks; == null covers both null and undefined in one comparison.

References#

  • null for the intentional-absence sibling.

  • Casting for == vs === coercion rules.