Created
February 27, 2020 14:23
-
-
Save muhammadawaisshaikh/df40f53b01f1f223e231229361478285 to your computer and use it in GitHub Desktop.
check if any object is same in two array of abjects
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
| // check if any object is same in two array of abjects | |
| const matchedRoles = []; | |
| allRoles.forEach(role => { | |
| const matchRoles = userRoles.map(userRole => { | |
| if (role.id === userRole.id) { | |
| // console.log(userRole.id); | |
| matchedRoles.push(userRole.id); | |
| // console.log(matchedRoles.indexOf(userRole.id)) | |
| } | |
| }); | |
| }); | |
| console.log(matchedRoles); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment