[{
id: '1',
childern: [{
id: '2',
children: [{
id: '9',
flag: true
}, {
id: '10'
}]
}]
},
{
id: '3',
childern: [{
id: '4',
flag: true,
children: [{
id: '5'
}, {
id: '6'
}]
}]
}]
如何將上面的資料過濾成下面的資料呢 只保留含有flag為true的資料,結構不能破壞
[{
id: '1',
childern: [{
id: '2',
children: [{
id: '9',
flag: true
}]
}]
},
{
id: '3',
childern: [{
id: '4',
flag: true,
children: [{
id: '5'
}, {
id: '6'
}]
}]
}]
uj5u.com熱心網友回復:
http://biwen.csdn.net轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/59653.html
標籤:JavaScript
