Skip to content

Instantly share code, notes, and snippets.

@karthickvkumar
Last active June 3, 2017 15:09
Show Gist options
  • Save karthickvkumar/d20eb95d2a2cea24c508ff669cdb8635 to your computer and use it in GitHub Desktop.
Save karthickvkumar/d20eb95d2a2cea24c508ff669cdb8635 to your computer and use it in GitHub Desktop.
Array difference
/*Return only difference array*/
[1,2].filter(function(i){
return [3,1].indexOf(i) < 0
})
/*Return concat difference array*/
[1,2].filter(function(i){
return [3,1].indexOf(i) < 0
}).concat([3,1].filter(function(i){
return [1,2].indexOf(i) < 0
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment