How can I check if a JavaScript variable is a Set
or Map
?
There is no equivalent to Array.isArray()
, so my best guess is something like:
c.__proto__.constructor.name === 'Set'
Are there any pitfalls I should be aware of with that approach? Or a better way?