Node Js Array.includes Not Working As Expected
I have the following code which should filter one dynamic array (up to 300 thousands elements) from all elements not contained in another constant array: orders[] // is already fi
Solution 1:
for (let scheme in schemes)
Thats how you iterate over keys in an object. Rather iterate over the entries in an array:
for (let scheme of schemes)
Additionally you should consider using the Set for lookup as its much faster. And map
and filter
might be useful:
const materials = newSet(schemes.map(scheme => scheme.typeID));
orders = orders.filter(el => materials.has(el.type_id));
Post a Comment for "Node Js Array.includes Not Working As Expected"