I always (thing != undefined || thing != null)?...:...;
check. Is there any method will return bool after this check in javascript or jquery ?
And how would you add this check in jquery as a function?
I always (thing != undefined || thing != null)?...:...;
check. Is there any method will return bool after this check in javascript or jquery ?
And how would you add this check in jquery as a function?
In Javascript, the values null
, undefined
, ""
, 0
, NaN
, and false
are all "falsy" and will fail a conditional.
All other values are "truthy" and will pass a conditional.
Therefore, you can simply write thing ? ... : ...
.