And why in the second array objects, if they contain only one field? Why not turn someOtherArr into [prodid1, prodid2, prodid3, ...] , then filtering in one line is implemented
Es6 syntax
const someArr = [{name:***, prodid:***, prodinfo:***}, ...] const someOtherArr = [prodid, prodid, prodid] const filtredArr = someArr.filter(el => someOtherArr.includes(el.prodid))
includes just checks if there is an element in the array, if yes returns true
If you still cannot change the structure of someOtherArr initially, then change it with your hands
const someArr = [{name:***, prodid:***, prodinfo:***}, ...] const someOtherArr = [{prodid}, {prodid}, {prodid}] // содержит значения prodid const mapedOtherArr = someOtherArr.map(el => el.prodid) const filtredArr = someArr.filter(el => mapedOtherArr.includes(el.prodid))