Skip to content

Instantly share code, notes, and snippets.

@serhatates
Last active October 17, 2019 06:03
Show Gist options
  • Save serhatates/b9fc8b73e4d6bb05e4bec4b9f2666d25 to your computer and use it in GitHub Desktop.
Save serhatates/b9fc8b73e4d6bb05e4bec4b9f2666d25 to your computer and use it in GitHub Desktop.
// Small ES6 tip
// How to remove duplicates from array
// Use the spread operator to transform a set into an Array
const array = [1, 2, 2, 3, 3, 5, 5, 1, 1];
const uniqueArray = [...new Set(array)];
// uniqueArray -> [1, 2, 3, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment