title: What difference is there in JavaScript between a constructor function, and function returning object which is invoked as a constructor?
body: <p>I know this is not the recommended way of doing it, but if I declare the following functions, and then invoke them as constructors, what will be the difference (if any) between the resulting objects?</p>
  
  <pre><code>function Something() {
      this.foo = "bar";
  }
  
  function something2() {
      var that = {};
      that.foo = "bar";
      return that;
  }
  
  var x = new Something();
  var y = new something2();
  var z = something2();
  </code></pre>
  
  <p>I.e. what will differ between <code>x</code>, <code>y</code> and <code>z</code> here?</p>
  
  <p>Wouldn't <code>something2</code> be a much better way of writing the constructor, since whether you use <code>new</code> or not will not affect the result of the function?</p>
  
  <p>BTW should <code>something2</code> be capitalized here? (I assume not since Crockford is so adamant on the capitalization, for functions will clobber the global namespace...)</p>