Skip to content

Instantly share code, notes, and snippets.

@coltpini
Created May 10, 2017 20:26
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 coltpini/60e0c4d2f8a6ec878b52f25c0a03d2cf to your computer and use it in GitHub Desktop.
Save coltpini/60e0c4d2f8a6ec878b52f25c0a03d2cf to your computer and use it in GitHub Desktop.
function Parent() {
this.prop = "prop";
this.anotherProp = "anotherProp";
}
// can I use arrow functions here?
Parent.prototype.someFunction = function() {
// ...
};
Parent.prototype.anotherFunction = function() {
// ...
};
function Child() {
// like calling super.
Parent.apply(this, arguments);
this.prop = "prop override";
}
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
Child.prototype.someFunction = function() {
// like calling super.
Parent.prototype.func1.apply(this, arguments);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment