using splice(0) to duplicate arrays
<p>I have two arrays: ArrayA and ArrayB. I need to copy ArrayA into ArrayB (as opposed to create a reference) and I've been using <code>.splice(0)</code> but I noticed that it seems to removes the elements from the initial array.</p>

<p>In the console, when I run this code:</p>

<pre><code>var ArrayA = [];
var ArrayB = [];

ArrayA.push(1);
ArrayA.push(2);

ArrayB = ArrayA.splice(0);

alert(ArrayA.length);
</code></pre>

<p><strong>the alert shows 0</strong>. What am I doing wrong with <code>.splice(0)</code>??</p>

<p>Thanks for your insight.</p>
