Other than creating a function, is there a shorter way to check if a value is undefined
,null
or false
only in JavaScript?
Try like Below
var Boolify = require('node-boolify').Boolify;
if (!Boolify(val)) {
//your instruction
}
Refer node-boolify
Well, you can always "give up" :)
function b(val){
return (val==null || val===false);
}
only shortcut for something like this that I know of is
var val;
(val==null || val===false) ? false: true;