Js Recursive Loop to add data?

how to add data with a tree structure to an id value. The rule is that the last bit of id in children is the last bit of parent id + 1

[ // 
    {
        value: "",
        id: "0",
        children: [
            {
                value: "",
                id: "0.1",
                children: [
                    {
                        value: "A",
                        id: "0.1.2",
                        children: [
                            {
                                id:"0.1.2.3",
                                value: ""
                            }
                        ]
                    },
                    {
                        value: "B",
                        id: "0.1.3",
                        children: [
                            {   id:"0.1.3.4",
                                value: ""
                            }
                        ]
                    },
                    {
                        value: "C",
                        id:"0.1.4",
                        children: [
                            {
                                value: "",
                                id:"0.1.4.5",
                            }
                        ]
                    },
                ]
            },
            { id: "0.2",value: "" },
            { id: "0.3",value: "" }
        ]
    },
    {
        value: "",
        id: "1",
        children: [
            { 
                value: "",id: "1.2"
                 children: [
                    {
                        value: "A",
                        id:"1.2.3",
                    }
                ]
            },
            { 
                value: "",id: "1.3",
                children: [
                    {
                        value: "A",
                        id:"1.3.4",
                    }
                ]
            }
        ]
    }
]
Jun.22,2021

let parent = [...] //
parent && parent.map((item,index) => {
    item.id = index;
    item.children &&  checkChild(item.child,item.id);
})

function checkChild(child,parentId) {
    child.map((item,index) => {
        item.id = parentId + "." + (parentId+1);
        item.children &&  checkChild(item.children,item.id);
    })
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3121e-2bd82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3121e-2bd82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?