I am facing a challenge with two arrays in my code. The first array is a jobs array of objects that contains an array itemIds. Here is an example:
jobs: [{
name: null
id: 612
items: []
stat: 1
itemIds: [223, 1234]
},
{
name: null
id: 734
items: []
stat: 2
itemIds: [564]
}
.
.
.
]
The second array is the items array, structured like this:
items: [{
act: true
id: 1234
name: "Item1"
},
{
act: true
id: 222
name: "Item2"
},
]
I need to filter out an array of items whose id doesn't match any of the itemIds from the jobs array or if the property 'stat' from the jobs array isn't equal to 0. I have attempted to solve this issue using three loops but it only removes one item with the same id in the jobs array. Any assistance on how to approach this problem would be highly appreciated.