Below is the code:
<script type="text/javascript">
function sortNumber(a,b)
{
return a - b;
}
var n = ["10", "5", "40", "25", "100", "1"];
document.write(n.sort(sortNumber));
</script>
I found this is w3school with no explain ay all!! Is sortnumber function is formula of sorting a number? What's mean a and b and why it exist? why sortNumber in n.sort(sortNumber) doesn't specify any parameter of a and b?Can anyone explain it to me? Thanks!!