How is it legal to use a function name as the argument to another function in JavaScript?
<p>I was gearing up for Javascript, reading the tutorials at <a href="http://w3schools.com" rel="nofollow">W3Schools</a> and came across this code:</p>

<pre><code>function sortNumber(a, b)
{
return a - b;
}

var n = ["10", "5", "40", "25", "100", "1"];
document.write(n.sort(sortNumber));
</code></pre>

<p>It sorts the elements in the Array, pretty simple. But how can we pass <code>sortNumber</code> ( a function name) as a parameter to the sort function?<br /><br />
<a href="http://w3schools.com/jsref/tryit.asp?filename=tryjsref_sort2" rel="nofollow">The original example</a></p>
