💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ //example 1 let a = {}, b = '0', c = 0; a[b] = '珠峰'; a[c] = '培训'; console.log(a[b]); //培训 ~~~ ![](https://img.kancloud.cn/9d/cb/9dcb9785a0a00cfada313307f585e165_686x509.png) > **为了理解可以说,对象的属性名只能是字符串,其它类型的值会先转为字符串,再去操作,但是要除去Symbol** ~~~ //example 2 let a = {}, b = Symbol('1'), c = Symbol('1'); a[b] = '珠峰'; a[c] = '培训'; console.log(a[b]); // 珠峰 ~~~ ![](https://img.kancloud.cn/7a/8d/7a8d76e41e82355f55e07c7c12e7a130_497x516.png) ![](https://img.kancloud.cn/a4/2d/a42daa655b70c00b612bb42a8c7988ab_487x146.png) ~~~ //example 3 let a = {}, b = { n: '1' }, c = { m: '2' }; a[b] = '珠峰'; a[c] = '培训'; console.log(a[b]); //培训 ~~~ ![](https://img.kancloud.cn/c5/3d/c53dcc78109dadfd66fcd2d8ecae0d94_670x510.png) ![](https://img.kancloud.cn/be/70/be70a9c143df215c00004eacfc6e97da_258x163.png)