Last active
October 17, 2019 06:03
-
-
Save serhatates/b9fc8b73e4d6bb05e4bec4b9f2666d25 to your computer and use it in GitHub Desktop.
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
// 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