title: How do I access originally passed array after sorting?
body: <p>When passing an array [2,1,3,5,3,2,1] to this function, I choose to sort from least to greatest. However, when I try to log or work with the original array, both "sorted" and "a" log the same sorted array. I am unsure as to why the sorting is going beyond the scope of just the variable "sorted".</p>
  
  <pre><code>function firstDuplicate(a) {
      let sorted = a.sort((a,b) =&gt; a - b);
      let duplicates = [];
      let indexes = [];
  
      console.log(sorted);
      console.log(a);
  </code></pre>
  
  <p>Any ideas? Thank you!</p>