Рет қаралды 7,284
Maps are similar to Objects. Sets are similar to Arrays. Both provide you with Iterators which means that both can be used with a for...of loop.
Plain JavaScript Objects are not Iterable.
You can pass an Array directly into a Set using the constructor.
For Objects you need to loop through the properties and pass them to a Map one at a time.
Code GIST: gist.github.com/prof3ssorSt3v...