title: Why javascript Sort method change other variable?
body: <p>I am new in Javascript.</p>
  
  <pre><code>function find_lowest_and_greatest(number) {
     const lowest = number.sort((a, b) =&gt; a - b);    // [1, 2, 3, 4, 5] 
     const greatest = number.sort((a, b) =&gt; b - a);  // [5, 4, 3, 2, 1]
  
     // after ^ line execute lowest value replace with greatest...But why? so lowest = [5, 4, 3, 2, 1] 
  
     return [lowest[0] , greatest[0]]
   }
  
   console.log(find_lowest_and_greatest([4, 5, 3, 1, 2])); // [5 , 5]
     // expected &gt; [1,5]
  </code></pre>
  
  <p>I expected result will be [1,5] But got [5,5]</p>