在javascript中对一个对象数组进行排序
摘要:
function sort(photoes) { var temp, j; for (var i = 1; i < photoes.length; i++) { if (compare(photoes[i], photoes[i - 1]) == -1) { temp = photoes[i]; j = i - 1; do { photoes[j + 1] = photoes[j]; j--; } while (j > -1 && compare(temp, photoes[j]) == -1); photoes[j + 1] = temp; } //endif } 阅读全文