【发布时间】:2016-04-23 05:36:34
【问题描述】:
以下是我的 JavaScript 对象。
{
"014b9d42":{
"notification": 0,
"userName": "adam"
},
"02f5b60e": {
"notification": 3,
"userName": "jake"
},
"1281d8fb": {
"notification": 1,
"userName": "eomer"
},
"12a2a564": {
"notification": 0,
"userName": "bella"
}
}
我想根据通知的值对上述对象进行排序。如何使用下划线 js 做到这一点?
【问题讨论】:
-
对象中没有顺序
-
你会想要一个数组而不是一个对象。也许让你的对象的键成为另一个属性,这样你就可以拥有一个对象数组
标签: javascript sorting underscore.js