Skip to content

Instantly share code, notes, and snippets.

@michaelnagy
Created October 13, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelnagy/43971c3538e2024232636c601ceaf6af to your computer and use it in GitHub Desktop.
Save michaelnagy/43971c3538e2024232636c601ceaf6af to your computer and use it in GitHub Desktop.
Returns the matches of the second Array of objects compared to the first
const getMatchsBetween = (Arr1, Arr2, propertyToCompare) => {
const matchesFound = Arr2.filter((Arr2Item => {
const found = Arr1.find(Arr2Item => {
return Arr2Item === dia[propertyToCompare]
})
return found !== undefined
}))
console.log('------------------------------------');
console.log(matchesFound);
console.log('------------------------------------');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment