Skip to content

Instantly share code, notes, and snippets.

@mkv27
Forked from bambooom/demo.js
Created March 14, 2018 21:00
Show Gist options
  • Save mkv27/87c412b444f0368c5abc040258b596b1 to your computer and use it in GitHub Desktop.
Save mkv27/87c412b444f0368c5abc040258b596b1 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