After the string is cut, the key of the object becomes a number?

clipboard.png

if, why does key become a number after a string is cut?

the result I want is {"000times:" first"}

the source code is here

Apr.10,2021

Before

es6, the key value of an object can only be a string. Whether you assign it or get it, it will convert your key to a string before operating

.
var a = {};
a[a] = 1;
//{[object Object]: 1}
Keyzhi of type Symbol has been added to

es6.

it is not appropriate for you to give an example here, because result will treat 000 as '0' , that is, the reason why your result [000] result is undefined is not because there is no '000' key, but because there is no ' 0' this key

.
var a = {};
a[000] = 1; //{0: 1}

clipboard.png
Oh, it is indeed a string, but the console displays like a number ~

Menu