Created
August 31, 2018 22:03
-
-
Save juanbrusco/504ef4d7ae2a5fd1bfb927ddc3db0ef9 to your computer and use it in GitHub Desktop.
Merge 2 arrays - Javascript
This file contains hidden or 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
merge_array(array1, array2, array3) { | |
const result_array = []; | |
array1.concat(array2, array3).forEach(item => { | |
if (result_array.indexOf(item) == -1) | |
result_array.push(item); | |
}); | |
return result_array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment