Created
March 19, 2020 14:09
-
-
Save emmabostian/870a51a62fb140928cc6a28473f2eedf 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
function diffArray(arr1, arr2) { | |
let arr1UniqueItems = arr1.filter(item => arr2.indexOf(item) < 0); | |
let arr2UniqueItems = arr2.filter(item => arr1.indexOf(item) < 0); | |
return [...arr1UniqueItems, ...arr2UniqueItems]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment