Why do two regex literals in my Javascript vary on a property?
<p>I read in <em>Javascript: The Good Parts</em> by Douglas Crockford that javascript regular expression literals share the same object. If so, then how come these two regex literals vary in the <code>lastIndex</code> property?</p>

<pre><code>var a = /a/g;
var b = /a/g;

a.lastIndex = 3;
document.write(b.lastIndex);​
</code></pre>

<p><a href="http://jsfiddle.net/5gTR2/" rel="nofollow">JS Fiddle</a></p>

<p>0 is outputted as opposed to 3.</p>
