To check for null SPECIFICALLY you would use this:
if (variable === null)
This test will ONLY pass for null
and will not pass for ""
, undefined
, false
, 0
, or NaN
.
Additionally, I've provided absolute checks for each "false-like" value (one that would return true…
Top comments (0)