ES6 Sets
set functions and their usage
A Set
data structure in ES6 is an ordered list of unique elements. Here are some set functions and their usage:
Keyword | Type | Usage |
---|---|---|
Set |
constructor | creates a set |
add |
method | adds elements to the set |
size |
property | check size of the set |
has |
method | check if an element is a member of the set |
delete |
method | remove a value from a set |
Consider the following code:
Get hands-on with 1400+ tech skills courses.