Assume there are two arrays like this:
const element = ['abc', 'def']`
const total = [
{ _id: 'foo', something: 'else' }
{ _id: 'abc' },
{ _id: 'bar' },
{ _id: 'def' }
]
I need to find the element items in the total array and return the index value. So the result should be
[1, 3]
I thought of using a loop and look up with indexOf, but that is not the correct way:
element.forEach(e => {
total.indexOf(e)
})