Skip to content

Instantly share code, notes, and snippets.

@bambooom
Created November 9, 2016 02:59
Show Gist options
  • Save bambooom/dd8af3665c484499f429496a5a9d9f61 to your computer and use it in GitHub Desktop.
Save bambooom/dd8af3665c484499f429496a5a9d9f61 to your computer and use it in GitHub Desktop.
merge two arrays and remove duplicate in es6
let arr1 = [3, 5, 2, 2, 5, 5];
let arr2 = [2, 1, 66, 5];
let unique = [...new Set([...arr1,...arr2])];
console.log(unique);
// [ 3, 5, 2, 1, 66 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment