Skip to content

Instantly share code, notes, and snippets.

@antoniocapelo
Created September 14, 2014 23:14
Show Gist options
  • Save antoniocapelo/b43000290fa81fcac6aa to your computer and use it in GitHub Desktop.
Save antoniocapelo/b43000290fa81fcac6aa to your computer and use it in GitHub Desktop.
Another method of extending classes in Javasript
function BaseClass () {
this.doSomething = function () {
};
}
BaseClass.prototype.someObject = {};
BaseClass.prototype.sharedSomething = function () {
};
ExtendedClass.prototype = Object.create(BaseClass.prototype);
function ExtendedClass () {
this.anotherSomething = function () {
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment