title: JS - Are arrays referenced?
body: <p>Need some help in understanding arrays in JS - from some code i just tried below, it appears that they are referenced? Is this correct?</p>
  <pre><code>const generatedNumbers = [1, 2, 3, 4, 5];
  const shuffleArrayNumbers = shuffleArray(generatedNumbers);
  
  shuffleArrayNumbers.shift();
  console.log(shuffleArrayNumbers);
  console.log(generatedNumbers);
  
  function shuffleArray(array) {
      return array.sort(() =&gt; Math.random() - 0.5);
  }
  </code></pre>
  <p>So I was expecting as <code>shuffleArrayNumbers</code> is in its own variable it would behave unique, however that's not the case. The two console.log outputs produce the same output.</p>
  <p>Could someone explain what's happening and how I can return a unique/new array.</p>
  <p>Thanks.</p>