MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/oe71tv/remove_duplicates_from_arrays_using_set/h4c9bxp/?context=3
r/learnjavascript • u/webdevolution_ • Jul 05 '21
44 comments sorted by
View all comments
18
What is the use of ... before new? Sorry if it's dumb I am very new to js
18 u/dvlsg Jul 05 '21 It's just turning the Set back into an Array.const filteredArray = Array.from(new Set(array));Would do basically the same thing. 1 u/hinsxd Jul 07 '21 Not exactly. A Set is "iterable", therefore it can be spreaded to an array.
It's just turning the Set back into an Array.
Set
Array
const filteredArray = Array.from(new Set(array));
Would do basically the same thing.
1 u/hinsxd Jul 07 '21 Not exactly. A Set is "iterable", therefore it can be spreaded to an array.
1
Not exactly. A Set is "iterable", therefore it can be spreaded to an array.
18
u/NANOwasFound Jul 05 '21
What is the use of ... before new? Sorry if it's dumb I am very new to js