Javascript Property Names

Javascript Property Names】  

  Property names must be strings. This means that non-string objects cannot be used as keys in the object. Any non-string object, including a number, is typecasted into a string via the toString method.

  

  This outputs "value", since 1 is type-casted into '1'.

  

  This also outputs "value", since both foo and bar are converted to the same string. In the SpiderMonkeyJavaScript engine, this string would be "['object Object']".

参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors

原文地址:https://www.cnblogs.com/tekkaman/p/6380940.html