Skip to content

Instantly share code, notes, and snippets.

@jaylandro
Last active March 13, 2021 22:04
Show Gist options
  • Save jaylandro/e2b7b82b9d65e7aded4d97a62fdd6563 to your computer and use it in GitHub Desktop.
Save jaylandro/e2b7b82b9d65e7aded4d97a62fdd6563 to your computer and use it in GitHub Desktop.
Symmetrical Array diff in JavaScript
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