Created
August 23, 2017 19:45
-
-
Save bcls/9a22ccc20dddbf3da5382e3b3f87a4f5 to your computer and use it in GitHub Desktop.
isdefined() #javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* tests for all the ways a variable might be undefined or not have a value | |
* @param {*} x the variable to test | |
* @return {Boolean} true if variable is defined and has a value | |
*/ | |
function isDefined(x) { | |
if ( x === '' || x === null || x === undefined) { | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment