Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[JavaScript] An example of how to use an optional parameter to detect if a variable is define
function acmeReferenceError( valueExists ) {
'use strict';
if ( undefined === valueExists ) {
/* If this is hit, then the function is being invoked
* before the variable in question has been defined.
*/
} else {
/* If this particular conditional is hit, then the function
* is being invoked after the value in question has
* been defined.
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.