title: Array.push() in duplicated object, incorrect or incomprehensible
body: <p>I found an issue/bad behavior <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push" rel="nofollow">Array.push()</a>. I'm not sure if I'm doing something wrong or if .push() method is incorrect.</p>
  
  <p>I will present a small example of what I'm dealing with</p>
  
  <pre><code>var x = [];
  function test()
  {
    var y = x;
    for(var i = 1; i&lt;10; i++)
    {
      y.push(i);
    }
    alert("x = " + x);
  }
  
  alert("x = " + x);
  
  test();
  
  //result:
  //1'st alert: x =
  //2'rd alert: x = 1,2,3,4,5,6,7,8,9
  </code></pre>
  
  <p>So my example is incomparable small with the real problem what I had in my project, I did fix it: adding methods parameters (x sent as parameter not shared with global scope) or objects cloning where was the case.</p>
  
  <p><strong>Questions:</strong>: </p>
  
  <ol>
  <li>Why push change <code>x</code> when the push is performed on <code>y</code> initialized with <code>x</code>?</li>
  <li>This example happens cross browsers, and I wondered if node.js do the same well surprise it does, now the question: I'm using wrong .push() method? And what is the correct approach to initialize objects from existing ones.</li>
  </ol>
  
  <p>Maybe my question is dumb, but I cannot find documented explanation.</p>
  
  <p>Thank you.</p>