Back to course home
0% completed
Vote For New Content
JavaScript - Sets
A Set in JavaScript is a collection of unique values of any type, whether primitive values or object references. Sets are particularly useful when the need to ensure the uniqueness of elements is a priority, as they automatically remove duplicates.
Syntax
To create a Set, you can use the Set()
constructor, optionally passing an iterable object (such as an array) to initialize the set with unique values from that iterable.
iterable
(optional): An array or other iterable object whose elements will be added to the new Set.
Example of Creating Sets
- Above code initialize
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page