DEV Community

Discussion on: Introduction to Sets in JavaScript – All You Need to Know

Collapse
 
alexdevero profile image
Alex Devero

This is just a guess. It could be for compatibility reasons. Objects (literals) contain data in the form of key-value pairs. The entries() should return both, key and value. Sets contain only values. Adding duplicates can be a way to make the result of entries() and its format consistent.