javascript assignment operator array
<p>I don't understand the assignment operator when assigning objects (say, arrays).  I'm told that as assignment operator copies the <strong>reference</strong>. However it seems like it copies the data.  For example:</p>

<pre><code>var globArray = [];

function test() {
  var names = ["craig", "silva"];
  globArray = names;
}//endFunction test

function test2() {
  console.log("el1: ", globArray[0], "el2: ", globArray[1]);
}//endFunction test2
</code></pre>

<p>When I call TEST, it creates array NAMES and assigns the global array "globArray" to NAMES.  Now it goes out of scope, so "names" is gone, right?  Then later I call test2, but it DOES show the elements!  So it must have COPIED the whole object, as opposed to just coping the reference.</p>

<p>Can someone explain this?</p>
