Is there a shorter way to checking if a value in JavaScript is null
or undefined
than this using new ES10 features like Nullish Coalescing?
(value !== null && value !== undefined)
There were other questions like
- Detecting an undefined object property in JavaScript
- How to determine if variable is 'undefined' or 'null'
- Is there a standard function to check for null, undefined, or blank variables in JavaScript?
But they all use either loose equality (==
), use jQuery or return false
even if the value is ""
, []
or 0
.