I just learned of an alternative for set to array
const myArr = Array.from(mySet1)
And if you want to iterate over a set without converting to an array.
for (const item of mySet1) { console.log(item) }
developer.mozilla.org/en-US/docs/W...
Array.from goes through iterator protocol for Set and Map, so it's exactly equivalent to the [... sugar.
Array.from
Set
Map
[...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I just learned of an alternative for set to array
And if you want to iterate over a set without converting to an array.
developer.mozilla.org/en-US/docs/W...
Array.fromgoes through iterator protocol forSetandMap, so it's exactly equivalent to the[...sugar.