How do I output the child array correctly?
   const arr = [
    [{ id: 0, parrentId: null, title: "Main tab", parrent: true }],
    [{ id: 1, parrentId: 0, title: "Main child 1", parrent: false }],
    [{ id: 2, parrentId: 0, title: "Main child 2", parrent: false }],
    [{ id: 3, parrentId: 2, title: "Main tab 2", parrent: true }],
    [{ id: 4, parrentId: 3, title: "Main child tab 2", parrent: false }]
  ];
How to output arrays according to child > parrent? But so that the id is parrentId === id
Main tab:
  1) Main child 1
  2) Main child 2
     1) Main tab 2
        1)Main child tab 2
I'm trying to
if (arr) {
    const child = arr.filter(({ hasChild }) => hasChild);
    const notChild = arr.filter(({ hasChild }) => !hasChild);
    const test = { ...child, notChild };
    console.log(test);
}