Inheritance in Javascript Using Prototype

I am going to define super class Vehicle with make and model properties and drive() method

Then I will define Car constructor function which will inherit from the Vehicle constructor function

In line 5 , you have Car.prototype=new Vehicle() statement which is used to inherit method and properties from the Vehicle super class

Now I will create object named myCar

make,modle properties comes from the super class and year property comes from the subclass. will call the drive() from the super class

If you need you can override the drive() function in Car subclass