JSFiddle - React, Tailwind, and code Playground

JavaScript

new Bla().start();

function Bla(){
    this.start = function(){
        alert("starting");
        x(this,'done');
    }

    this.done = function(){
        alert("done");
        try{
            this.postDone();
        }
        catch(e){
            alert(e);
        }
    }

    this.postDone = function(){
        alert("postdone");
    }
}

function x(object,funcName){
    alert("x");
    try{
        object[funcName]();
    }
    catch(e){
        alert(e);
    }
}