Multi-level nested array of objects, there is an id, to find according to this id, and this id is related to the id, I write as follows, I do not know where the problem?
as follows, the id is 113. You want to get an array like 1Magne11113 (not implemented through str.splice, etc.)
var arr = [
{
"menuId": 1,
"menuName": "",
"defaultIcon": "icon-wulianwangjiankong",
"path": "/internet_things",
"childs": [
{
"menuId": 11,
"menuName": "",
"defaultIcon": "icon-home",
"path": "/internet_things/home",
"childs": [
{
"menuId": 111,
"menuName": "",
"defaultIcon": "",
"path": "/internet_things/home/data_analyse",
"childs": []
},
{
"menuId": 112,
"menuName": "",
"defaultIcon": "",
"path": "/internet_things/home/device_loc",
"childs": []
}
]
}
]
}
];