How can I fetch objects from an array from an array which match an array of id's? Is this possible? I'd ideally like to grab only the ones that I need, rather than fetching objects that I don't need and then filtering them as this seems not very performant.
const objects = [
{
id: "1",
name : "one",
},
{
id: "1",
name : "two"
},
{
id: "3",
name : "three",
},
{
id: "4",
name : "four"
},
{
id: "5",
name : "five"
}
]
const ids = ['1', '3', '5'];
let myFilteredObjects = await fetch('./objects');
// myObjects should return and an array of objects with 1, 3, 5