Skip to content

Instantly share code, notes, and snippets.

@davidlonjon
Last active December 15, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidlonjon/5219278 to your computer and use it in GitHub Desktop.
Save davidlonjon/5219278 to your computer and use it in GitHub Desktop.
JavaScript: Set default argument value
set_default_arg = function(arg, default_value) {
if (arg === null || typeof arg === 'undefined') {
return default_value;
}
return arg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment