title: How to call a function during object construction in Javascript?
body: <p>I want to create an object and run two of its methods on object creation. So if my object is </p>
  
  <pre><code>function newObj(){
  this.v1 = 10;
  this.v2 = 20;
  this.func1 = function(){ ....};
  this.func2 = function(){...};
  }
  </code></pre>
  
  <p>and the call to the object is </p>
  
  <pre><code>var temp = new newObj();
  </code></pre>
  
  <p>I want to run <code>func1()</code> and <code>func2()</code> without calling them explicity on temp variable, like <code>temp.func1()</code>.  I want them to be called when I create the new Object variable. I tried putting <code>this.func1()</code> inside the <code>newObj</code> declaration but it doesn't seem to work. </p>