two deep arrays An and B with different levels of depth have the same ID. If they exist, mark them under the corresponding object in array A
.var A= [{
id: 1
}, {
id: 2,
children: [{
id: 3
}, {
id: 4
}, {
id: 5,
children: [{
id: 6
}]
}]
}];
var B= [{
id: 1
}, {
id: 2,
children: [{
id: 5,
children: [{
id: 6
}]
}]
}];
let c = method(A,B)
//
c = [{
id: 1,
disabled:true
}, {
id: 2,
disabled:true,
children: [{
id: 3
}, {
id: 4
}, {
id: 5,
disabled:true,
children: [{
id: 6,
disabled:true
}]
}]
}];