Created
December 7, 2016 17:56
-
-
Save olaferlandsen/bb3c5929a46dd5a6c78e97e15235a0ab to your computer and use it in GitHub Desktop.
Check if a variable exists in 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
/** | |
* simple | |
*/ | |
function isDefined (varname) { | |
return window.hasOwnProperty(varname); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment