DEV Community

Max Angelo Dapitilla Perin
Max Angelo Dapitilla Perin

Posted on

Answer: How do I check for null values in JavaScript?

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…

Latest comments (0)