title: JavaScript sorting of an array with mixed type values
body: <p>I have the following array which needs to be numerically sorted in descending order:</p>
  
  <pre><code>var arr = ['5', '5.1', '5.1.4', '6.0.0', '500'];
  </code></pre>
  
  <p>The needed order is like follows:</p>
  
  <pre><code>500
  6.0.0
  5.1.4
  5.1
  5
  </code></pre>
  
  <p>However all the methods I've tried don't seem to give the needed result. An example of such a sort function which won't work with that kind of array:</p>
  
  <pre><code>arr = arr.sort(function(a,b){return b - a});
  </code></pre>
  
  <p>Could anybody please give me a hint on how can this be achieved?</p>
  
  <p>Thanks.</p>