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]".
Javascript 不能用对象作为key,所有对象都会hash到一个key上
最新推荐文章于 2022-12-06 23:29:21 发布
本文解释了在JavaScript中所有对象的属性名都是字符串形式这一概念,并通过实例说明当使用非字符串值作为属性名时,这些值如何被转换为字符串。
5081

被折叠的 条评论
为什么被折叠?



