Last active
March 31, 2017 10:02
-
-
Save ppraksa/8d3b830b26a9d74cf980de73c0d5e704 to your computer and use it in GitHub Desktop.
Like a parasite
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
Object.prototype.parasiteCopy = function(obj, args) { | |
if(typeof obj.constructor === 'function') { | |
obj.apply(this, args); | |
} | |
} | |
var Plant = function(colour,roots) { | |
this.colour = colour; | |
this.roots = roots | |
} | |
var Letuce = { hasLeavs: true, height: 13 } | |
Letuce.parasiteCopy(Plant, ['green',true]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment