title: Copying an array produces strange results ('copying'==referencing)
body: <p>EDIT: the problem I came across was that I did not know that js arrays are treated as objects and any as so are referenced not copied. If you were interested in simply reversing a js array you can use...reverse();</p>
  
  <p>I thought I would be able to simply do the following in javascript</p>
  
  <pre><code>var originalArray = [1,2,3,5,8,13];
  var originalArrayCOPY = originalArray;
  console.log ("new copy = "+originalArrayCOPY);
  
  for(var zyx = 0; zyx &lt;6; zyx++){
      var xyz = 5-zyx;
      originalArray[zyx] = originalArrayCOPY[xyz];
  }
  
  console.log("original now "+originalArray);
  console.log("copy ="+originalArrayCOPY);
  </code></pre>
  
  <p>But my results are so strange that I feel I must not understand javascript at all!!</p>
  
  <p>new copy = 1,2,3,5,8,13 </p>
  
  <p>original now 13,8,5,5,8,13, </p>
  
  <p>copy =13,8,5,5,8,13, </p>
  
  <p>I can-t see why this wouldn-t work and I honestly am not sure why the COPY of the original array is changed at all. </p>
  
  <p>If I could at least name the problem I could ask google, also if you tell me the name of the problem I will rename by SO question.</p>