I\'ve seem different approaches for (strict equality) checking for undefined
:
if (something === undefined)
if (typeof some
undefined
undefined
. Older version of the JS standard let you change the value of undefined
as it's just a variable. void 0
is undefined
, it's safer.An extra one:
if (x == null)
. Tests for undefined
and null
because undefined == null
but remember, undefined !== null
In JavaScript there's a type 'undefined'
and a value undefined
. The value undefined
is of type 'undefined'
.