JS里面sort(sortNum)方法中的sortNum为毛"return a - b"就是升序?
<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-08
举报