为什么函数是sortNum而不是sortNum()啊,为什么不加括号呢
<script type="text/javascript">
function sortNum(a,b) {
return b-a;
}
var myarr = new Array("80","16","50","6","100","1");
document.write(myarr.sort(sortNum));
</script>
<script type="text/javascript">
function sortNum(a,b) {
return b-a;
}
var myarr = new Array("80","16","50","6","100","1");
document.write(myarr.sort(sortNum));
</script>
2016-08-05
举报