JSFiddle - React, Tailwind, and code Playground

JavaScript

function vehicle(name, color)
{
    if(this instanceof arguments.callee)
    {    
        this.name = name;
        this.color = color;
    }
    else return new arguments.callee(arguments);   
}
 
vehicle.prototype = {
    getName : function()
    {
        alert(this.name);
    }
}
    
function Car(name, color, speed)
{
        this.name = name;
        this.color = color;
        this.speed = speed;
}
 
Car.prototype = vehicle();
var obj = new Car("Ford", "Red", "200mph");
obj.getName();
alert(obj instanceof vehicle);