Is it possible to check for nullish values as part of an if block, without resorting to a pair of explicit checks for null
and undefined
.
For example, don't want to do this:
if(key === null || key === undefined) {
// do something
}
This doesn't work, because it also includes other falsy values such as zero and empty array.
if(!key)