Last active
October 4, 2017 15:36
-
-
Save erikpantzar/410556d07f7bea26afa54028ae98d275 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
const o = ['abc', 'hejhej', 'defg']; | |
const n = ['hejhej', 'defg', 'JOHAN']; | |
const getDiff = (current, neu) => { | |
return neu.filter((item, index) => { | |
if(current.indexOf(item) === -1) { | |
return item | |
} | |
}) | |
} | |
console.log(getDiff(o, n)) // returns ['JOHAN'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment