Skip to content

Instantly share code, notes, and snippets.

@ih2502mk
Created January 6, 2014 15:12
Show Gist options
  • Save ih2502mk/8284176 to your computer and use it in GitHub Desktop.
Save ih2502mk/8284176 to your computer and use it in GitHub Desktop.
Javascript prototypal inheritance.
var __extends = function (child, parent) {
for (var p in parent) {
if (Object.prototype.hasOwnProperty.call(parent, p)) {
child[p] = parent[p];
}
}
function __() {
this.constructor = child;
}
__.prototype = parent.prototype;
child.prototype = new __();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment