Last active
June 3, 2017 15:09
-
-
Save karthickvkumar/d20eb95d2a2cea24c508ff669cdb8635 to your computer and use it in GitHub Desktop.
Array difference
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
/*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