I am working with two arrays. The structure of the first array is as follows:
items: [
{
name: "a",
items: [
{ name: "jack" },
{ name: "jose" },
]
},
{
name: "b",
items: [
{ name: "lara" },
{ name: "jo" },
]
},
{
name: "c",
items: [
{ name: "andy" },
{ name: "hary" },
]
}
]
Now, let's move on to the second array:
number: [
0: [0, 1],
1: [1],
2: [0]
]
I need to filter the "items" based on the values in the "number" array. What would be the best solution to achieve the desired output?
{["jack", "jole"],["jo"],["andy"]}