Skip to content

Instantly share code, notes, and snippets.

@sethetter
Created March 25, 2013 18:31
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 sethetter/5239423 to your computer and use it in GitHub Desktop.
Save sethetter/5239423 to your computer and use it in GitHub Desktop.
Inherit prototype function for OOP in Javascript.
function inheritPrototype(childObject, parentObject) {
var copyOfParent = Object.create(parentObject.prototype);
copyOfParent.constructor = childObject;
childObject.prototype = copyOfParent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment