Skip to content

Instantly share code, notes, and snippets.

@revathskumar
Last active December 23, 2015 23:29
Show Gist options
  • Save revathskumar/6710484 to your computer and use it in GitHub Desktop.
Save revathskumar/6710484 to your computer and use it in GitHub Desktop.
extend/Inheritance and bind method created by CS
__bind = function(fn, me){
return function(){
return fn.apply(me, arguments);
};
}
__hasProp = Object.prototype.hasOwnProperty;
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key))
child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment