Skip to content

Instantly share code, notes, and snippets.

@gipi
Created November 7, 2011 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gipi/1345558 to your computer and use it in GitHub Desktop.
Save gipi/1345558 to your computer and use it in GitHub Desktop.
Hineritance in Javascript by __proto__ property
// source: <http://www.2ality.com/2011/11/javascript-classes.html>
var PersonProto = {
describe: function () {
return "Person called " + this.name;
},
};
var jane = {
__proto__: PersonProto,
name: "Jane",
};
var tarzan = {
__proto__: PersonProto,
name: "Tarzan",
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment