title: Singleton Access Private methods acces public methods
body: <p>I have created a single class but I'm having a little trouble accesing the public methods from the private ones. My example is this:</p>
  
  <pre><code>var mySingleton = (function () {
  
    function init() {
  
      function privateMethod(){
          publicMethod();
          //this.publicMethod() also doesn't work
      }
  
      privateMethod();
  
      return {
  
        publicMethod: function () {
          console.log( "The private method called me!" );
        }
      };
    };
  
    return {
      getInstance: function () {
  
        if ( !instance ) {
          instance = init();
        }
  
        return instance;
      }
    };
  })();
  
  var singleton = mySingleton.getInstance();
  </code></pre>
  
  <p>It seems that the scopes are completely different. Should I be creating a singleton in a different way?</p>