The reason for this is that in JavaScript, all object property names are strings, and any non-string value placed inside a square bracket property accessor is converted into a string. In the example above, key1 and
key2 are both converted to "[object Object]".