JSFiddle - React, Tailwind, and code Playground
by Artem
JavaScript
var Module = (function () {
var myModule = {};
var _privateMethod = function (num) {
return num * num;
};
myModule.publicMethod = function (num) {
return _privateMethod(num);
};
myModule.anotherPublicMethod = function () {
};
return myModule; // returns the Object with public methods
})();
// использование
console.log(Module.publicMethod(5));