大家好,我仍然无法正确对数组进行排序。我们需要对以下数组进行排序:
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)