title: Javascript singleton: How to access private variables?
body: <p>I have this singleton. The public functions allow to set private variables but I am not able to set them in the way that I am able to use them in the private methods:</p>
  
  <pre><code>var ServiceInterface = (function () {
    // Instance stores a reference to the Singleton
    var instance;
  
    function init() {
      // Singleton
      // Private methods and variables
      var m_action;
  
      function performAction() {
        alert(m_action);
      }
  
      return {
        // Public methods and variables
        callBackend: function (sAction) {
          m_action = sAction;
        }
      };
    };
  })
  </code></pre>
  
  <p><code>m_action</code> is not available throughout the public and private section of the singleton. What am I doing wrong?</p>