Created
February 24, 2015 19:42
-
-
Save mralexho/68904149289f8b27bad7 to your computer and use it in GitHub Desktop.
function that makes the child object inherit from parent object
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 inheritPrototype(childObject, parentObject){ | |
var parentCopy = Object.create(parentObject.prototype); | |
parentCopy.constructor = childObject; | |
childObject.prototype = parentCopy; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment