JSFiddle - React, Tailwind, and code Playground

JavaScript

var c = function(obj){
    var _self = this;
    this.name = "lol";
    this.setSelf = function( t ){
        // perhaps additional rule around setting _self here
        _self = t;
    };
    this.init = function(){
        this.setSelf( this );
    }
    this.sayName = function(){
        console.log(_self.name);
    }
    $.extend(this,obj);
    this.init();
    
}

var A = new c({
    name : "A",
    init : function(){
        this.setSelf( this );
    },
    sayA : function(){
        console.log(_self);
    }
});

var B = new c({
    name : "B",
    init : function(){
        this.setSelf( this );
    }
});

A.sayA();

B.sayName();