var arr2=[100,20,3,23,7];console.log(arr2.sort(down));function add(i,j){ //升序(从小到下) return i-j;}function down(i,j){ //降序(从大到小) return j-i;}