JSFiddle - React, Tailwind, and code Playground

HTML

<h1>Yet Another Javascript Inheritance</h1>

JavaScript

var Class = function(definition) {
	var base = definition.extend || null;
	var construct = definition.construct || definition.extend || function() {};
		
	var newClass = function() { 
		this._base_ = base;        
		construct.apply(this, arguments);
	}

    if (definition.name) 
        newClass._name_ = definition.name;
    
	if (definition.extend) {
		var f = function() {}		
		f.prototype = definition.extend.prototype; 		
		newClass.prototype = new f(); 	
		newClass.prototype.constructor = newClass;
		newClass._extend_ = definition.extend;		
		newClass._base_ = definition.extend.prototype;         
	}
    
	if (definition.statics) 
		for (var n in definition.statics) newClass[n] = definition.statics[n];		    
	
	if (definition.members) 
		for (var n in definition.members) newClass.prototype[n] = definition.members[n];	
    
	return newClass;
}


var Animal = Class({
                    
    construct: function() {        
    },
            
    members: {

        speak: function() {
            console.log("nuf said");                        
        },
        
        isA: function() {        
            return "animal";           
        }        
    }
});


var Dog = Class({  extend: Animal,

    construct: function(name) {  
        this._base_();        
        this.name = name;
    },
                 
    statics: {
        Home: "House",
        Food: "Meat",
        Speak: "Barks"
    },
    
    members: {
        name: "",
        
        speak: function() {
            console.log( "ouaf !");         
        },
        
        isA: function(advice) {
           return advice + " dog -> " + Dog._base_.isA.call(this);           
        }        
    }
});


var Yorkshire = Class({ extend: Dog,

    construct: function(name,gender) {
        this._base_(name);      
        this.gender = gender;
    },
                       
    members: {
        speak: function() {
            console.log( "ouin !");           
        },
        
       ...