title: Javascript Class Constructor Call Method
body: <p>In Java you could call methods to help you do some heavy lifting in the constructor, but javascript requires the method to be defined first, so I'm wondering if there's another way I could go about this or if I'm forced to call the method that does the heavy lifting after it's been defined. I prefer to keep instance functions contained within the Object/Class, and it feels weird that I would have to have the constructor at the very end of the object/class.</p>
  
  <pre><code>function Polynomials(polyString)
  {
      // instance variables
      this.polys = [];
      this.left = undefined;
      this.right = undefined;
  
      // This does not work because it's not yet declared
      this.parseInit(polyString);
  
      // this parses out a string and initializes this.left and this.right
      this.parseInit = function(polyString)
      {
          //Lots of heavy lifting here (many lines of code)
      }
  
      // A lot more instance functions defined down here (even more lines of code)
  
      // Is my only option to call it here?
  }
  </code></pre>