title: Why doesn't the sort function of javascript work well?
body: <p>This simple javascript</p>
  
  <pre><code>var x = new Array();
  x[0] = 2.73;
  x[1] = 11.17;
  x[2] = 3.12
  x.sort();
  
  for(var i in x)
      alert(x[i]);
  </code></pre>
  
  <p>produces the results:
  <code>11.17, 2.73, 3.12</code> instead of <code>2.73, 3.12, 11.17</code>.</p>
  
  <p>Why is that and how can I fix it?</p>
  
  <p>Thanks in advance!</p>