I currently have two arrays with a bunch of ids. I want to compare the two arrays to see what ids match, then return an array with only the matching ids. I've tried multiple approaches, but nothing seems to work so far. This is what I've done:
const filteredIdArray = array1.filter((item) =>
array2(item)
);
const filteredIdArray = array1.filter(
(item) => array2.indexOf(item) !== -1
);
Both attempts were pulled from other examples, and neither is working. I did make sure that my array1 and array2 were actually arrays not objects. Is there something I'm missing here?