let object = [{
"ItemAID" : 1,
"ItemADesc" : [ {
"ItemBid" : 11,
"ItemBDesc" : [ {
"ItemCid" : 111,
"ItemCTitle" : "TitleC111",
}, {
"ItemCid" :112,
"ItemCTitle" : "TitleC112",
} ]
}]},
{
"ItemAID" : 2,
"ItemADesc" : [ {
"ItemBid" : 21,
"ItemBDesc" : [ {
"ItemCid" : 211,
"ItemCTitle" : "TitleC211",
}, {
"ItemCid" :212,
"ItemCTitle" : "TitleC212",
} ]
}]}]
console.log(X.find(A => A.ItemADesc.find(B => B.ItemBDesc.find(C=>C.ItemCid === 212)?.ItemCTitle)));
当 ItemCid 与 id 匹配时,我正在尝试查找 ItemCTitle。上面的代码作为一个整体返回 ItemAID:2 对象,而不是返回嵌套的变量值。任何线索表示赞赏。
慕勒3428872
RISEBY
相关分类