Created
October 13, 2020 20:23
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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