creating objects with new vs. {} in javascript
<p>There are two ways of creating an object in javascript:</p>

<ol>
<li>use new on a "constructor function"</li>
<li>return a dictionary {} and set the proper key/value pairs</li>
</ol>

<p>The first is, for example</p>

<pre><code>FooType = function() {
    this.hello = function() { alert("hello"); };
};

foo = new FooType();
foo.hello();
</code></pre>

<p>the second is</p>

<pre><code>fooFactory = function() {
    return { 
        hello : function() { alert("hello"); }
    };
};

foo = fooFactory();
foo.hello();
</code></pre>

<p>(Code written for the post. not guaranteed correct)</p>

<p>Apart from risks of mistakes of having this bound to the global object, are these two method totally equivalent (also considering prototype inheritance etc...)?</p>
