JSFiddle - React, Tailwind, and code Playground

JavaScript

var object = (function () {
        var someField,
            anotherField,

            init = function () {
                someField = 1;
                anotherField = 2;
            },
            someMethod = function () {
                anotherMethod();
            },
            anotherMethod = function () {
                alert(someField);
            };

        return {
            init: init,
            someMethod: someMethod
        };
    })()
    
    object.init();
    object.someMethod();