Skip to content

Instantly share code, notes, and snippets.

@a-double
Created November 9, 2016 15:37
Show Gist options
  • Select an option

  • Save a-double/314d224b895020312d0b10f23d20fad7 to your computer and use it in GitHub Desktop.

Select an option

Save a-double/314d224b895020312d0b10f23d20fad7 to your computer and use it in GitHub Desktop.
Objects linking to other objects
var Wrapper = {
create: function() {
return Object.create( Wrapper );
},
stuff: function() {
console.log( 'stuff' );
}
};
var Extension = Object.create( Wrapper );
Extension.stuff = function() {
console.log( 'other stuff' );
};
var item = Extension.create().stuff(); // 'other stuff'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment