代码如下:
let china = {
zhejiang: {
hangzhou: 'xihu'
}
// xihu
console.log(china.zhejiang.hangzhou)
console.log(china['zhejiang']['hangzhou'])
// 能否通过 key 来访问 china 使之能输出 xihu
console.log( china[key] )
相关分类