Skip to content

Instantly share code, notes, and snippets.

@nulltier
Created April 21, 2013 21:40
Show Gist options
  • Save nulltier/5431179 to your computer and use it in GitHub Desktop.
Save nulltier/5431179 to your computer and use it in GitHub Desktop.
var defaults = {
zero: 0,
one: 1
};
var myOptions = Object.create(defaults);
var yourOptions = Object.create(defaults);
// When I want to change *just* my options
myOptions.zero = 1000;
// When you wanna change yours
yourOptions.one = 42;
// When we wanna change the **defaults** even after we've got our options
// even **AFTER** we've already created our instances
defaults.two = 2;
myOptions.two; // 2
yourOptions.two; // 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment