title: revealing module pattern (javascript) - this cannot access private methods
body: <p>:I have a javascript class written in the 'revealing module pattern':</p>
  
  <pre><code>myObject = function () {
      var varA,
          varB,
  
          methodA = function (data) {
  
              //Some code...
          },
          methodB = function (data) {
               var that = this;
               that.methodA("a"); // --&gt; 'that' recognize only public methods: 'methodB' / 'methodC' !!!
          },
          methodC = function (data) {
  
          };
          return {
              methodB : methodB,
              methodC : methodC,
           };
  } ();
  </code></pre>
  
  <p>as you can see in 'this' inside 'methodB' does not recognize private methods of the class. </p>
  
  <p><strong>Edit:</strong>
  My intention was to call a helper private method from a public class. Within this private class I needed 'this'. If I call 'methodA("a")' directly from 'methodB' (without 'that') I do not have 'this' ('this' will be global context). The solution will be: </p>
  
  <pre><code>methodA.call(this, "a");
  </code></pre>