I have an array of objects that look similar to the following:
let array = [
{
id: 1,
name: Foo,
tools: [{id:3, toolname: Jaw},{id:1, toolname: Law}]
},
{
id: 2,
name: Boo,
tools: [{id:2, toolname: Caw}]
},
{
id: 3,
name: Loo,
tools: [{id:3, toolname: Jaw}, {id:4, toolname: Maw}]
}
]
I am trying to filter objects from the above array using something similar to includes against an existing array which looks like the following:
let secondarray = ['Jaw', 'Taw']
How would I return a list of objects which has a tool named within the second array?
Thanks for your time!