S
S
Stanislav Ponomarev2020-04-16 16:16:04
JavaScript
Stanislav Ponomarev, 2020-04-16 16:16:04

How does newSet() work?

I can't figure out how the new Set() method works. How does it create uniqueness? For example, I have an array let a = ['Q', 'W', 'E', 'W', 'R', 'R']how to remove duplicate letters using new Set(). To return ['Q', 'W', 'E', 'R']. With the help of filter () I can do it, but new Set () has not yet been parsed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tigran Abrahamyan, 2020-04-16
@Chelentano93

https://learn.javascript.ru/map-set#set
[...new Set(a)]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question