如何使用冒泡排序在Javascript中对二维数组进行排序?

时间:2015-04-28 05:14:07

标签: javascript sorting

这是原始数据,在ajax请求中返回:

TimeSpan totaldays = endtime.Subtract(starttime);
double tdays = totaldays.TotalDays;

我希望按每个项目的第一个字段对其进行排序,结果应为:

{
    "oLB3ujqaG123xf--hVY223Oq1ZI": [
        45,
        "兔子",
        1430124206
    ],
    "oLB3ujl4555Ksj6UwTyK22242Y": [
        121,
        "燕子",
        1430191889
    ],
    "oLB3242SUyXKaaefwTyKKuN42Y": [
        11,
        "豹子",
        1430191889
    ]
}

我尝试的方式是:

{
    "oLB3242SUyXKaaefwTyKKuN42Y": [
        11,
        "豹子",
        1430191889
    ],
    "oLB3ujqaG123xf--hVY223Oq1ZI": [
        45,
        "兔子",
        1430124206
    ],
    "oLB3ujl4555Ksj6UwTyK22242Y": [
        121,
        "燕子",
        1430191889
    ] 
}

它不起作用,为什么?

0 个答案:

没有答案