data= {
"name": "root",
"size": "4",
"Rate": "4",
"level": "3",
"children": [
{
"name": "C1",
"size": "8",
"Rate": "8",
"level": "4",
"children": [
{
"name": "C11",
"size": "8",
"Rate": "8",
"level": "5",
"children":[]
}
]
}
]
}
js judgment? ?
Use hasownproperty('children') to encapsulate whether the node contains children
Then traverse or while judgment, if there are no children at this time, it is the end, and then judge it