Last active
March 13, 2021 22:04
-
-
Save jaylandro/e2b7b82b9d65e7aded4d97a62fdd6563 to your computer and use it in GitHub Desktop.
Symmetrical Array diff in JavaScript
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
function arrayDiffSym(arr1, arr2) { | |
return [ | |
...arr1.filter(item => !arr2.includes(item)), | |
...arr2.filter(item => !arr1.includes(item)), | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment