Created
October 6, 2017 14:22
-
-
Save TiagoNunesDeveloper/44aa437af7b0a330d3a33a332efd6e98 to your computer and use it in GitHub Desktop.
concat filter
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
var arr1 = [1, 2, 3] | |
var arr2 = [1, 3, 5] | |
var arr3 = arr1.concat(arr2).filter(function (item, index, array) { | |
return array.indexOf(item) === index | |
}) | |
console.log(arr3) // [1, 2, 3, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment