Skip to content

Instantly share code, notes, and snippets.

@jonathanmarvens
Last active December 27, 2015 14:19
Show Gist options
  • Save jonathanmarvens/7340201 to your computer and use it in GitHub Desktop.
Save jonathanmarvens/7340201 to your computer and use it in GitHub Desktop.
function classExtend(subClass, superClass) {
for (var property in superClass) {
if (superClass.hasOwnProperty(property)) {
subClass[property] = superClass[property];
}
}
function constructor() {
this.constructor = subClass;
}
constructor.prototype = superClass.prototype;
subClass.prototype = new constructor();
}
function classExtend(a,b){function d(){this.constructor=a}for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment