Created
January 6, 2012 08:18
-
-
Save psiborg/1569650 to your computer and use it in GitHub Desktop.
JS Object Defaults 1
This file contains hidden or 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 setBG (options) { | |
| var args = { | |
| red: 255, | |
| green: 255, | |
| blue: 255 | |
| } | |
| // overwrite defaults | |
| for (var i in options) { | |
| args[i] = options[i]; | |
| } | |
| document.body.style.backgroundColor = "rgb(" + args.red + "," + args.green + "," + args.blue + ")"; | |
| } | |
| setBG({red: 128, blue: 100}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment