I like to use the !!
in Javascript to ensure that a variable is set and that no error will be thrown.
However today I have a variable with 0
value that is valid for me. I need to ensure that it is not NaN nor undefined, is there really no short way to do it without the boring if (variable !== NaN && variable !== undefined
?
If that may help, I am using angular.
Thx.