there is a problem at present. To get all the id in a multidimensional array, the dimension of the array is uncertain. Although there are at most five layers, the loop is too bloated to write, and the recursive algorithm is not very familiar with
.var arr = [
{
id: 1,
type: "",
children: [
{
id: 2,
type: "",
children: [
{
id: 3,
type: "",
children: [
{
id: 4,
type: "",
children: [...]
}
]
}
]
}
]
}
]
how to get all the id
in arr