<分区>
我正在尝试按 id 对 follow 数组进行分组。
我试过使用 lodash,但我的结果也是重复 id 即 "id":[6,6,6,6]
这是我现有的数组;
[
{
"nestedGroups": 64,
"id": 6
},
{
"nestedGroups": 27,
"id": 6
},
{
"nestedGroups": 24,
"id": 6
},
{
"nestedGroups": 69,
"id": 6
}
]
我的预期结果是使用 id 作为键将 nestedGroups 组合成一个数组。
[
{
"nestedGroups": [64,27,24,69],
"id": 6
}
]