Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 803 Bytes

README.md

File metadata and controls

27 lines (23 loc) · 803 Bytes

Build Status
NPM

a super small javascript Inheritance framework based out on John Resig blog https://johnresig.com/blog/simple-javascript-inheritance/

  var Vehicle = Class.Create({
    init: function(wheels) {
      this.wheels = wheels;
    }
  });

  var Truck = Vehicle.Extend({
    init: function(hp, wheels) {
      this._super(wheels);
      this.horsepower = hp;
    },
    printInfo: function() {
      console.log('I am a truck and I have ' + this.wheels +
        ' wheels and ' + this.horsepower + ' hp.');
    }
  });
  
  var t = new Truck(350, 4);
  t.printInfo();