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.
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'm puzzled why
entries()
return an array for each element, containing the same thing twice. What's the use of that?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 ofentries()
and its format consistent.