JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output"></div>

JavaScript

var testModule = (function($) {
    var privateMethod = function() {
        appendText("called privateMethod()");
        publicAlert();
    };

    var appendText = function(text) {
        var text2 = $('#output').text() + " | " + text;
        $('#output').text(text2);
    };

    var publicAlert = function() {
        alert("publicAlert");
    };

    var publicMethod = function() {
        appendText("called publicMethod()");
        privateMethod();
    };
    
    return {
        publicMethod: publicMethod,
        publicAlert: publicAlert
    };
}(jQuery));

$(function() {
    testModule.publicMethod();
});