mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
17 lines
331 B
Markdown
17 lines
331 B
Markdown
---
|
|
id: ee9a4791-e3e8-4437-98fa-6c2d34be1a8e
|
|
title: JavaScript Sets
|
|
---
|
|
|
|
# Introduction
|
|
|
|
A
|
|
[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
|
|
is a collection of unique elements.
|
|
|
|
# Example
|
|
|
|
``` javascript
|
|
const arr = [5, 1, 5, 7, 7, 5];
|
|
const unique = [...new Set(arr)]; // [ 5, 1, 7 ]
|
|
```
|