Last active
August 29, 2015 14:21
-
-
Save allthetime/ec621fce00dbafe0cb86 to your computer and use it in GitHub Desktop.
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
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