JS

function compare(a, b) {

return -1; // a 在 b 前面

return 1; // a 在 b 后面
return 0; // 并列排序,保持在源数组中的先后顺序 }
原文地址:https://www.cnblogs.com/andremao/p/7214654.html