字符串减字符串也会转化为数字???
function sortNum(a,b) { return a-b;// } var myarr = new Array("80","16","50","6","100","1"); document.write(myarr.sort(sortNum)); ......... 请问,数组中的不是字符串吗,为什么还可以相减后进行排序?? 难道字符串减字符串也可以转化成数字??
function sortNum(a,b) { return a-b;// } var myarr = new Array("80","16","50","6","100","1"); document.write(myarr.sort(sortNum)); ......... 请问,数组中的不是字符串吗,为什么还可以相减后进行排序?? 难道字符串减字符串也可以转化成数字??
2016-08-03
举报