title: Sort in ascending order but keep highest at beginning in javascript?
body: <p>I have an array which looks like this</p>
  
  <pre><code>arr = ["#4abc", "#2xyz", "#3pol", "#33pe", "#1bfj", "#11lo", "#2mao"]
  </code></pre>
  
  <p>Each element in the array is associated with a <code>#n</code>. Now I want to sort them in ascending order. 
  So this is what I do</p>
  
  <pre><code>arr.sort( (a,b) =&gt; a.match(/#(\d)/)[1] - b.match(/#(\d)/)[1])
  </code></pre>
  
  <p>Gives me the expected output</p>
  
  <pre><code>arr ['#1bfj', '#11lo', '#2xyz', '#2mao', '#3pol', '#33pe', '#4abc']
  </code></pre>
  
  <p>But I also want to keep the highest in the beginning such that it looks like this</p>
  
  <pre><code>arr ['#4abc', '#1bfj', '#11lo', '#2xyz', '#2mao', '#3pol', '#33pe']
  </code></pre>
  
  <p>Now I know <code>#4</code> is the highest that can occur in an array. So this is what I tried</p>
  
  <pre><code>arr.sort((a, b) =&gt; (a.match(/#(\d)/)[1] === "4") - (b.match(/#(\d)/)[1] === "4") || a.match(/#(\d)/)[1] - b.match(/#(\d)/)[1]);
  </code></pre>
  
  <p>But I don't get the expected output. How can I do this?</p>