title: Sort version-dotted number strings in Javascript?
body: <p>I have an array of following strings:</p>
  
  <pre><code>['5.5.1', '4.21.0', '4.22.0', '6.1.0', '5.1.0', '4.5.0'] 
  </code></pre>
  
  <p>...etc.</p>
  
  <p>I need a solution that will give me following ordered result</p>
  
  <pre><code>['4.5.0', '4.21.0', '4.22.0', '5.1.0', '5.5.1', '6.1.0'].
  </code></pre>
  
  <p>I tried to implement a sort so it first sorts by the numbers in the first position, than in case of equality, sort by the numbers in the second position (after the first dot), and so on... </p>
  
  <p>I tried using <strong>sort()</strong> and <strong>localeCompare()</strong>, but if I have elements <code>'4.5.0'</code> and <code>'4.11.0'</code>, I get them sorted as <code>['4.11.0','4.5.0']</code>, but I need to get <code>['4.5.0','4.11.0']</code>.</p>
  
  <p>How can I achieve this?</p>