Skip to content

Instantly share code, notes, and snippets.

@allthetime
Last active August 29, 2015 14:21
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 allthetime/ec621fce00dbafe0cb86 to your computer and use it in GitHub Desktop.
Save allthetime/ec621fce00dbafe0cb86 to your computer and use it in GitHub Desktop.
function AttArg(options) {
if (!options) var options = {};
// a default value is given in case the options object doesn't contain an option
var option_one = options.option_one || 1
var option_two = options.option_two || 2
// do something
return [option_one, option_two];
}
// now you run the function like this
AttArg({
option_one: "one",
option_two: "two",
});
// will return ["one", "two"];
//or without an options object
AttArg();
// the default values will be returned [1, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment