Created
September 11, 2017 08:17
-
-
Save olehwebdev/5bf2801c0a216a5bdd9831d0811a234d to your computer and use it in GitHub Desktop.
This code returns a new array|object, only unique numbers.
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
const array = [1,1,2,3,4,5,5,5,6,7,8]; | |
const array2 = new Set(array); | |
const uniq = [...new Set(array)]; | |
//Unique Array | |
console.log('Unique array', uniq); | |
//Unique Object | |
console.log('Object', array2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment