Skip to content

Instantly share code, notes, and snippets.

@munro
Created August 7, 2011 17:31
Show Gist options
  • Save munro/1130569 to your computer and use it in GitHub Desktop.
Save munro/1130569 to your computer and use it in GitHub Desktop.
JavaScript OOP

Bad:

{{gist bad_inheritance.js}}

Good:

{{gist inheritance.js}}

function Foo() {
}
Foo.prototype = new Bar();
function Foo() {
}
Foo.prototype = Object.create(Bar.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment