I have below list in javascript
–
[
{
"id" : 111,
"type": "BASE",
"someOtherProp": "other",
"linkedId": 222
},
{
"id" : 222,
"type": "CHILD",
"someOtherProp": "other",
"linkedId": 111
},
{
"id" : 333,
"type": "SOMEOTHERTYPE",
"someOtherProp": "other",
"linkedId": 444
}
]
I want to check in list if type === 'BASE'
, get the linkedId
of matching type and check in same list if CHILD
is present. If CHILD
is not present then break the loop
and throw the exception or alert the message.
Note : BASE’s object linkedId
is CHILD’s object id
.
I am planning to use nested loop but looking a better approach if any for this.
Thank you.