Created
February 13, 2019 15:44
-
-
Save MahmoudAgamy/342298a57df283a237754fbdcd8c6dbd to your computer and use it in GitHub Desktop.
This file contains 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
// subtracting arr2 from arr1 | |
let subtracting = arr1.filter(x => !arr2.includes(x)); | |
// intersection between arr1 and arr2 | |
let intersection = arr1.filter(x => arr2.includes(x)); | |
// NotIntersection: all elements but intersection elements | |
let NotIntersection = | |
arr1.filter(x => !arr2.includes(x)) | |
.concat(arr2.filter(x => !arr1.includes(x))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment