小编Til*_*ode的帖子

JS 对对象数组进行排序

大家好,我仍然无法正确对数组进行排序。我们需要对以下数组进行排序:

const arr = [
     {id: 3123124, parentId: 0o0000, title: 'title', type: 'block'},
     {id: 3542132, parentId: 3123124, title: 'title', type: 'child'},
     {id: 12345, parentId: 88888, title: 'title', type: 'block'},
     {id: 24124, parentId: 12345, title: 'title', type: 'child'},
     {id: 99999, parentId: 45324, title: 'title', type: 'child'},
     {id: 986648, parentId: 3123124, title: 'title', type: 'block'},
     {id: 77777, parentId: 88888, title: 'title', type: 'child'},
     {id: 54232, parentId: 3123124, title: 'title', type: 'child'},
     {id: 54308, parentId: 15075, title: 'title', type: 'child'},
     {id: 66666, parentId: …
Run Code Online (Sandbox Code Playgroud)

javascript arrays sorting

5
推荐指数
1
解决办法
180
查看次数

标签 统计

arrays ×1

javascript ×1

sorting ×1