Why is this not possible?
var value = null;
if(value == (null || ""))
{
//do something
}
I would like to check a value if it is null or empty without using the variable over and over again.
Use !value. It works for undefined, null and even '' value:
var value = null;
if(!value)
{
console.log('null value');
}
value = undefined;
if(!value)
{
console.log('undefined value');
}
value = '';
if(!value)
{
console.log('blank value');
}
javascript check null or empty string OP says string value @epascarellovalue = '0'; then !value is false
(value == null || value == "")??