JSFiddle - React, Tailwind, and code Playground

HTML

<pre class="log"></pre>

JavaScript

var logLine = function(comment, element) {
    this.count = this.count + 1 || 0;
    comment = comment || "undescribed event";
    $("pre.log").append(this.count + " - " +comment + "\n");
}
        
var incScript = {
    list : [],//List of scripts
    load : function(scriptList, callback) { //Load array of scripts, with callbackoption
        var params = {}
        callback = callback || (function(){});
        var incThis = this;
        try {
            //Check if this script is already loaded
            for (i in incThis.list) {
                if (incThis.list[i] === scriptList[0]){
                    scriptList.shift();    //Remove it from loading queue
                }
            }
            if (scriptList.length === 0) {
                callback(params);
                return ;
            } else {
                logLine("\tScript loaded: "+ scriptList[0]);
                incThis.list.push(scriptList[0]);
                scriptList.shift();
                incThis.load(scriptList, callback);
                return ;
                /*
                //jQuery dependant code that replaces above (actually loads scripts)
                $.getScript(scriptList[0], function() {
                    incThis.list.push(scriptList[0]);
                    scriptList.shift();
                    incThis.load(scriptList, callback);
                    return ;
                });
                */
            }
        } catch(e) {
            logLine("There was an error loading this page." + e);
            return false;
        }
    }
};

var script1 = "https://ajax.googleapis.com/ajax/libs/dojo/1.10.3/dojo/dojo.js";
var script2 = "https://ajax.googleapis.com/ajax/libs/prototype/1.7.2.0/prototype.js";
var script3 = "https://ajax.googleapis.com/ajax/libs/threejs/r69/three.min.js";

logLine("Loading group A");
logLine("Already Loaded: " + incScript.list.join(", "))
incScript.load([script1,script2]);
logLine("-------------");

logLine("Loading group...