I have the following array of objects:
[{
itemType: 'bottle',
itemId: '111'
}, {
itemType: 'bottle',
itemId: '222'
}, {
itemType: 'bottle',
itemId: '333'
}]
I'm trying to filter (time complexity of O(n)) it by a simple array like the following:
[ '111', '333' ]
So the final array of objects looks like this:
[{
itemType: 'bottle',
itemId: '222'
}]
I thought using underscoreJS
but there's no builtin function to accomplish this in a simple manner. Any other options?