title: JavaScript class - Call method when object initialized
body: <p>I have a class similar to the one below. How do I call my <code>init</code> method when the object is created? I don't want to have to create an instance of my object then call initialize like I do below. </p>
  
  <pre><code>var myObj = new myClass(2, true);
  myObj.init();
  
  function myClass(v1, v2) 
  {
      // public vars
      this.var1 = v1;
  
      // private vars
      var2 = v2;
  
      // pub methods
      this.init = function() {
          // do some stuff        
      };
  
      // private methods
      someMethod = function() {
          // do some private stuff
      };
  }
  </code></pre>