直接上例子 1.无参调用返回按unicode字符编码排序 var arr = [1,2,0,21,15,6,34,9,45]; var arrSort = arr.sort(); console.log(arrSort);//会返回[0,1,15,2,21,34,45,6,9] 2.有参调用,参数为匿名函数 var arr = [1,2,0,21,15,6,34,9,45]; var arrSort = arr.sort(function(a,b){return a-b}); console.l…