JSFiddle - React, Tailwind, and code Playground

JavaScript

var injectSuper = function (parent, child) {
    child.prototype.$super = parent.prototype;
};

var breaker = 0;

var Top = function () {
    alert("you won");
};

var Middle = function () {
    alert("recursion");
    breaker++;
    if (breaker < 5) {
        this.$super.constructor.apply(this, arguments);
    }
};

var Bottom = function () {
    this.$super.constructor.apply(this, arguments);  
};

injectSuper(Middle, Bottom);
injectSuper(Top, Middle);

new Bottom();