Today I read this article in medium, and I don't understand about spread operator below.
I know that the spread operator is used to receive array as a parameter in a function. In the code above, what does the spread operator do? Convert object to array?
In that context, three dots
...
are referred to asrest parameters syntax
, notspread syntax
. In the code included in your question, the context in which three dots...
are used, it is known asspread syntax
.It iterates over the
Set
and spreads (adds) the entries in theSet
in to a new arrayFollowing code snippet shows a simple example: