function getSortArray(lst) { var lstBeforeSort = []; for (var i in lst) { lstBeforeSort.push(lst[i]); } var lstAfterSort = lst.sort(function (a, b) { return b - a }); var sortArray = []; function isContains(arrayList, o) { for (var i in arrayList) { if (arrayList[i] == o) return true; } return false; } for (var i in lstAfterSort) { for (var a in lstBeforeSort) { if (lstAfterSort[i] == lstBeforeSort[a]) { //如果在排序数列里面已经有了这个索引 那么继续往下找 if (isContains(sortArray,a)) continue; else { sortArray.push(a); break; } } } } return sortArray; }