Javascript bir diziyi birden çok parametreye göre nasıl sipariş edebilirim
Kod örnekleri
1
0
nesne dizisini 2 anahtar değerine göre sırala
homes.sort(
function(a, b) {
if (a.city === b.city) {
// Price is only important when cities are the same
return b.price - a.price;
}
return a.city > b.city ? 1 : -1;
});