自定义排序返回值为1时,无效果
var arr = ["国","处","科","处","科","处","科","部","国","司","处","部","国","部","司","处","司","处","司","处","科"];
function arrSort(a,b){
if( (a=="国" && ( b=="部" || b=="司" || b=="处" || b=="科")) ||
(a=='部' && ( b=='司' || b=='处' || b=='科') ) ||
(a=='司' && ( b=='处' || b=='科')) ||
(a=='处' && b=='科' ) ){
return -1;
}
if(a == b){
return 0;
}
}
document.write(arr.sort(arrSort));