Classes
Tags : JavaScript Intro
Classes
function Human(name){
    this.name = name;
    this.powerSource = "food";
    this.greet = function(){
      console.log("Hello my name is " + this.name + ", do you have any " + this.powerSource + "?");
    }
    this.changeName = function(newName){
      this.name = newName;
    }
  }
  function Robot(){
    Human.apply(this, arguments);
    this.powerSource = "nuts and bolts";
  }Try the following:
- Create your own class. It can be of anything, try to pick something general.
 - Now try to make a sub-class that is more specific. Bicycle > Mountain bike
 - Try to reuse the methods of the first class in the sub-class.