JSFiddle - React, Tailwind, and code Playground
by marcosc
JavaScript
function Vehicle() {
this.registration = Math.random();
}
function LandVehicle(){}
function Car(){}
function SportsCar(){}
function RacingCar(){Vehicle.call(this)}
LandVehicle.prototype = new Vehicle();
Car.prototype = new LandVehicle();
SportsCar.prototype = new Car();
RacingCar.prototype = new SportsCar();
//now we are free to set other prototypes .
Vehicle.prototype.make = null;
Vehicle.prototype.model = null;
Vehicle.prototype.registration;
//formula1 cars
var f1 = new RacingCar();
var f2 = new RacingCar();
//returns two different numbers
console.log( f1.registration, f2.registration )