Skip to content

Instantly share code, notes, and snippets.

@ryanmorr
Created August 3, 2016 05:44
Show Gist options
  • Save ryanmorr/9fe745640541382b1906b94196fd2492 to your computer and use it in GitHub Desktop.
Save ryanmorr/9fe745640541382b1906b94196fd2492 to your computer and use it in GitHub Desktop.
Inherit the prototype of a function
function inherit(subclass, superclass) {
subclass.prototype = Object.create(superclass.prototype, {
constructor: {
value: subclass
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment