📌  相关文章
📜  按 2 个键值对对象数组进行排序 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:31.705000             🧑  作者: Mango

代码示例1
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;
   });