Created
May 10, 2017 20:26
-
-
Save coltpini/60e0c4d2f8a6ec878b52f25c0a03d2cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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