关于排序函数的参数
<script type="text/javascript">
function sortNum(a,b) {
return a - b;
//升序,如降序,把“a - b”该成“b - a”
}
var myarr = new Array("80","16","50","6","100","1");
document.write(myarr + "<br>");
document.write(myarr.sort(sortNum));
</script>
传递的实参是数值型字符串,怎么也可以使用减法?如果是其它类型的数据呢?比如字母型字符串,布尔类型等