Skip to content

Instantly share code, notes, and snippets.

@christopherhill
Created December 7, 2013 02:44
Show Gist options
  • Select an option

  • Save christopherhill/7836660 to your computer and use it in GitHub Desktop.

Select an option

Save christopherhill/7836660 to your computer and use it in GitHub Desktop.
Javascript Classic Inheritance
var Automobile = function() {
this.automobile = true;
}
var Car = function() {
this.car = true;
}
var Bus = function() {
this.bus = true;
}
Car.prototype = new Automobile();
var auto = new Automobile();
var myPorsche = new Car();
var myGreyhound = new Bus();
console.log(auto);
console.log(myPorsche);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment