Answer the question
In order to leave comments, you need to log in
Is it correct to use non-iterable elements inside a Set?
MDN says that ([])
only iterable elements can be used
internally .
new Set([iterable]);
let set = new Set([{key: 'value'}, 23]);
Answer the question
In order to leave comments, you need to log in
You need to practice reading the documentation a little.
[] means an optional argument, not an array as you might think.
In your example, you are passing an array, which is an iterable object.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question