Ascending number sorting - sort()
<p>The call to <code>n.sort(sortNo)</code> doesn't specify any parameters for the function <code>sortNo</code> (which defines parameters of <code>a</code> and <code>b</code>). Can anyone explain why?</p>

<pre><code>&lt;script type="text/javascript"&gt;
 function sortNo(a,b)
 {
    return a - b;
 }
 var n = ["10", "5", "40", "25", "100", "1"];
 document.write(n.sort(sortNo));
&lt;/script&gt;
</code></pre>

<p>Is <code>return a - b;</code> the formulae used?</p>

<p>I know that <code>sortNo</code> is provided with two items. Does a numerical operation return the following?</p>

<ul>
<li>a negative value, if <code>a</code> is before <code>b</code></li>
<li>a positive value, if <code>b</code> is before <code>a</code></li>
<li>zero: if <code>a</code> and <code>b</code> are equal</li>
</ul>
