JSFiddle - React, Tailwind, and code Playground

by nerdycap007

JavaScript

function Car(brand, milage) {
	this.brand = brand;
  this.milage = milage;
  
  this.getCarDetails = function () {
  	console.log(this.brand, this.milage)
  }
}

function SmallCar(brand, milage, color) {	
	Car.call(this, brand, milage)
  this.color = color
  
  this.getColor = function() {
  	console.log(this.brand, this.milage,this.color)
  }
}

let mercedes = new Car('mercedes', 20)

let smallMercedes = new SmallCar('mercedes', 40, 'red')
smallMercedes.getColor()