Skip to content

Instantly share code, notes, and snippets.

@eamon0989
Last active July 26, 2021 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eamon0989/3a1ed539c999b9349e711509def8fea5 to your computer and use it in GitHub Desktop.
Save eamon0989/3a1ed539c999b9349e711509def8fea5 to your computer and use it in GitHub Desktop.
function Factory() {
this.foo = 1;
this.bar = 'string';
}
Factory.prototype.example = "I'm a property of Factory.prototype";
console.log(Factory.prototype); // { example: "I'm a property of Factory.prototype" }
let descendant = new Factory();
console.log(descendant); // Factory { foo: 1, bar: 'string' }
console.log(descendant.example); // I'm a property of Factory.prototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment