JSFiddle - React, Tailwind, and code Playground

by MartijnR

JavaScript

function FormHTML() {
    this.input = new this.Input();
    this.branch = new this.Branch(this);
    this.branch.dobranch();
};

FormHTML.prototype.Input = (function() {
    function Input() {

    }

    Input.prototype.doinput = function() {
        console.log('doing input (tried to reach this code from branch property');
    };

    return Input;
})();

FormHTML.prototype.Branch = (function() {
    function Branch(parent) {
        this.parent = parent;
    }

    Branch.prototype.dobranch = function() {
        console.log('doing branch');
        this.parent.input.doinput();
    };

    return Branch;
})();

form = new FormHTML();