JSFiddle - React, Tailwind, and code Playground

JavaScript

( function ( MYAPI ) {

	// internal value
  
  var name = 'test';
  
  // public interface
  
  Object.assign( MYAPI, {
  
  	getValue: function() {
    
    	return name;
      
    }
    
	} );
 
} )( window.MYAPI = window.MYAPI || {} );


console.log( MYAPI.getValue() );