say I have a list of objects like so.
const list = [{id: 1, name: "foo"}, {id: 2, name: "bar"}, {id: 3, name: "baz"}]
And then I have a list of items I'd like to find in said list.
const ids = [1, 3]
how can I return an array of objects that match the ids found in ids from list using javascript?
heres an example of the return I'd like to see given I have [1, 3].
-> [{id: 1, name: "foo"}, {id: 3, name: "baz"}]
Thanks - Josh
list.filter(({ id }) => ids.includes(id))