我有这个 lngArr:
[
{
"data": {
"18746": 20.75,
"id": "18746",
"impression": 20.75
},
"name": "Missing"
},
{
"data": {
"18748": 77.91,
"id": "18748",
"impression": 77.91
},
"name": "English"
},
{
"data": {
"18749": 0.02,
"id": "18749",
"impression": 0.02
},
"name": "Spanish"
},
{
"data": {
"18751": 0.31,
"id": "18751",
"impression": 0.31
},
"name": "Arabic"
},
{
"data": {
"18753": 0.01,
"id": "18753",
"impression": 0.01
},
"name": "Chinese"
},
{
"data": {
"18757": 0.01,
"id": "18757",
"impression": 0.01
},
"name": "Dutch"
},
{
"data": {
"18760": 0.01,
"id": "18760",
"impression": 0.01
},
"name": "French"
},
{
"data": {
"18763": 0.69,
"id": "18763",
"impression": 0.69
},
"name": "Hebrew"
},
{
"data": {
"18764": 0.08,
"id": "18764",
"impression": 0.08
},
"name": "Hindi"
},
{
"data": {
"18771": 0.2,
"id": "18771",
"impression": 0.2
},
"name": "Korean"
},
{
"data": {
"18772": 0.01,
"id": "18772",
"impression": 0.01
},
"name": "Latvian"
},
{
"data": {
"18786": 0.01,
"id": "18786",
"impression": 0.01
},
"name": "Turkish"
}
]
这是我的排序代码:
lngArr.sortBy(function(lng) {
return -lng.data.impression;
});
我不知道为什么它不起作用。这是文档。