Returns true if value is neither null nor undefined. Useful as a type predicate for filtering arrays.
true
value
null
undefined
The value to check.
isDefined(0) // => trueisDefined(null) // => false[1, null, 2, undefined].filter(isDefined) // => [1, 2] Copy
isDefined(0) // => trueisDefined(null) // => false[1, null, 2, undefined].filter(isDefined) // => [1, 2]
Returns
trueifvalueis neithernullnorundefined. Useful as a type predicate for filtering arrays.