Skip to content

Instantly share code, notes, and snippets.

@bicknest
Created November 9, 2019 22:41
Show Gist options
  • Save bicknest/1db39db9d7581f6481b0cf440011c6c3 to your computer and use it in GitHub Desktop.
Save bicknest/1db39db9d7581f6481b0cf440011c6c3 to your computer and use it in GitHub Desktop.
const fooProto = {
data: {
descriptor: 'bar'
},
printDescriptor: () => console.log(this.data.descriptor),
};
const foo1 = Object.create(fooProto);
const foo2 = Object.create(fooProto);
foo1.data = {descriptor: 'baz'};
foo2.printDescriptor();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment