In Javascript, why is [1, 2] == [1, 2] or ({a : 1}) == ({a : 1}) false?
<p>The following is done in Firebug:</p>

<pre><code>&gt;&gt;&gt; [1, 2] == [1, 2]
false

&gt;&gt;&gt; ({a : 1}) == ({a : 1})
false
</code></pre>

<p>I thought Javscript has some rule that says, if an Object or Array has the same references to the same elements, then they are equal?</p>

<p>But even if I say</p>

<pre><code>&gt;&gt;&gt; foo = {a : 1}
Object { a=1}

&gt;&gt;&gt; [foo] == [foo]
false

&gt;&gt;&gt; ({a: foo}) == ({a: foo})
false
</code></pre>

<p>Is there a way to make it so that it can do the element comparison and return <code>true</code>?</p>
