JSFiddle - React, Tailwind, and code Playground

JavaScript

Function.prototype.inheritsFrom=function(parentClsOrObj){
    if (parentClsOrObj.constructor == Function ){
        //Normal Inheritance
        this.prototype = new parentClsOrObj;
        this.prototype.constructor = this;
        this.prototype.parent=parentClsOrObj.prototype;
    } else {
        //Pure Virtual Inheritance
        this.prototype = parentClsOrObj;
        this.prototype.constructor = this;
        this.prototype.parent = parentClsOrObj;
    }
    return this;
}
//
var LivingThing = {
    beBorn : function(){
        this.alive = true;
    }
}

//

function Mammal(name){
    this.name=name;
    this.offspring=[];
}

Mammal.inheritsFrom( LivingThing );

Mammal.prototype.haveABaby=function(){
    this.parent.beBorn.call(this);
    var newBaby=new this.constructor( "Baby "+this.name);
    this.offspring.push(newBaby);
    return newBaby;
}

//

function Cat( name ){
    this.name=name;
}

Cat.inheritsFrom(Mammal );

Cat.prototype.haveABaby=function(){
    var theKitten = this.parent.haveABaby.call(this);
    alert("mew!");
    return theKitten;
}

Cat.prototype.toString=function(){
    return '[Cat "'+this.name+'"]';
}

//
var tom = new Cat( "Tom" );

var kitten = tom.haveABaby( ); // mew!

alert( kitten ); // [Cat "Baby Tom"]