title: Is this the correct way to do private functions in Javascript / node.js?
body: <p>A class I'm writing in node.js is as below:</p>
  
  <pre><code>module.exports = exports = function(){ return new ClassA() };
  
  function ClassA(){
      this.myvariable = 0;
  }
  </code></pre>
  
  <p>I have a function that I want to be private. To my understanding if the function is declared outside of the constructor, it will essentially be a static function which wouldn't be able to reference this.myvariable.</p>
  
  <p>Is the correct way of dealing with this to declare the function within the constructor like this:</p>
  
  <pre><code>//within constructor
  this.myFunction = function myFunction(){
      console.log(this.myvariable)
  }
  </code></pre>
  
  <p>Or is there a better way of doing it that doesn't leave me with a potentially huge constructor?</p>
  
  <p>EDIT: It looks like I've misunderstood something here because the above code doesn't even work...</p>