摘要:
1 //数组排序 2 var n = [15, 99, 23, 42, 4, 8, 16]; 3 n.sort(function(a, b) { 4 return a - b 5 }); 6 console.log(n); 7 8 //字符串排序 9 var m = ['aa', 'bb', 'a', 4, 8, 15, 16, 23, 42];10 m.sort(function(a, b) {11 if (a === b) {12 return 0;13 }14 if (typeof a === typeof b) {15 ... 阅读全文