JSFiddle - React, Tailwind, and code Playground

by rodneyjoyce

JavaScript

var MyModule = ( function( window, undefined ) {
  
  function myMethod() {
    alert( 'my method' );
  }
  
  function myOtherMethod() {
    alert( 'my other method' );
  }
  
  // explicitly return public methods when this object is instantiated
    //bring the { after return back onto the same line as return
  return   
  {
    someMethod : myMethod,
    someOtherMethod : myOtherMethod
  };
  
} )( window );

MyModule.someMethod(); // alerts "my method"