Created
July 10, 2020 13:09
-
-
Save rishisidhu/cd4a40dbcb3378c09b5a1b8123c0d666 to your computer and use it in GitHub Desktop.
Modern JS ES6+ features - Sets
This file contains 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
//Create set from an array | |
var set1 = new Set([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]); | |
console.log(set1); | |
//Add a new element to it | |
set1.add(5); | |
console.log(set1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment