Skip to content

Instantly share code, notes, and snippets.

@juanbrusco
Created August 31, 2018 22:03
Show Gist options
  • Save juanbrusco/504ef4d7ae2a5fd1bfb927ddc3db0ef9 to your computer and use it in GitHub Desktop.
Save juanbrusco/504ef4d7ae2a5fd1bfb927ddc3db0ef9 to your computer and use it in GitHub Desktop.
Merge 2 arrays - Javascript
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