JavaScript Examples

The Bad Parts

isNaN() (is Not a Number): isUndefined, isNotSet, isNotDefined, void, ['item'], {prop:'item'}, {}
!isNaN() (is a number): null, number, [], "", 0, false

isNull typeof object
isNull === null
isNull == null
isNull == undefined
isNull is a number (!isNaN)

isUndefined typeof undefined
isUndefined == null
isUndefined === undefined
isUndefined == undefined
isUndefined isNaN

isNotSet typeof undefined
isNotSet == null
isNotSet === undefined
isNotSet == undefined
isNotSet isNaN

isNotDefined typeof undefined
isNotDefined == null
isNotDefined === undefined
isNotDefined == undefined
isNotDefined isNaN

isVoid typeof undefined
isVoid == null
isVoid === undefined
isVoid == undefined
isVoid isNaN

isArray typeof object
isArray instanceof Array
isArray instanceof Object
isArray isNaN

isObject typeof object
isObject instanceof Object
isObject isNaN

isEmptyArray typeof object
isEmptyArray instanceof Array
isEmptyArray instanceof Object
isEmptyArray == false
isEmptyArray == 0
isEmptyArray == ""
isEmptyArray is a number (!isNaN)

isEmptyObject typeof object
isEmptyObject instanceof Object
isEmptyObject isNaN

isEmptyString typeof string
isEmptyString == false
isEmptyString == 0
isEmptyString == []
isEmptyString === ""
isEmptyString == ""
isEmptyString is a number (!isNaN)

isZero typeof number
isZero == false
isZero === 0
isZero == 0
isZero == []
isZero == ""
isZero is a number (!isNaN)

isFalse typeof boolean
isFalse === false
isFalse == false
isFalse == 0
isFalse == []
isFalse == ""
isFalse is a number (!isNaN)