title: javascript new self invoking function
body: <p>I've got a question about self invoking functions in javascript.</p>
  
  <p>What I'm doing is something similar to the following</p>
  
  <pre><code>myNamespace =  {}; //namespace for holding any objects/functions 
  
  //helpModule as an example
  
  myNamespace.HelpModule = new (function(){
      this.abc = '123';
      //lots of other code in here...
  })();
  </code></pre>
  
  <p>now I'm able to access properties of myNamespace.HelpModule like so:</p>
  
  <pre><code>alert(myNamespace.HelpModule.abc);
  </code></pre>
  
  <p>But for starters jsLint doesn't like that saying "Weird construction. Delete 'new'.",
  And this <a href="http://sweatte.wordpress.com/javascript-optimization/javascript-best-practices" rel="nofollow noreferrer">page</a> states that you shouldn't use Function Constructor, although in this case I'm not sure if its using the Function Constructor since its a self invoking function?</p>
  
  <p>Anyway, it seems to work fine, and the reason I'm using it is to have "this" scope to the function instead of the global object (window). I could just defining it as an object literal or do something similar to </p>
  
  <pre><code>myNamespace.HelpModule = (function(){
      var obj = {};
      obj.abc = '123';
  
      return obj;
  }();
  </code></pre>
  
  <p>but neither of these seem as "elegant" to me.</p>
  
  <p>I'm wondering if this is bad form/practice?</p>