Why Javascript sort() function is not giving the expected output?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1063007/sort-not-working-with-integers">sort not working with integers?</a><br>
  <a href="http://stackoverflow.com/questions/4576903/how-to-sort-number-in-javascript-sort-method">How to sort number in javascript sort method</a><br>
  <a href="http://stackoverflow.com/questions/7000851/array-sort-doesnt-sort-numbers-correctly">Array.sort() doesn&#39;t sort numbers correctly</a>  </p>
</blockquote>



<p>Code:</p>

<pre><code>var x = [40,100,1,5,25,10];
x.sort();
</code></pre>

<p>output: </p>

<pre><code>1,10,100,25,40,5
</code></pre>

<p>My expected output:</p>

<pre><code>1,5,10,25,40,100
</code></pre>
