【发布时间】:2023-03-24 17:09:01
【问题描述】:
let will_pokemon = {
pikachu: {
species: 'Mouse pokemon',
height: 0.4,
weight: 5
}
}
let samson_pokemon = {
raichu = {
species: 'Rare pokemon',
height: 0.8,
weight: 12
}
}
let weight4 = samson_pokemon?.pikachu?.weight //check either object property available if not will be undefined
console.log(weight4)
为什么在我的 Chrome 浏览器上运行时出现 Invalid shorthand property initializer 错误?
【问题讨论】:
-
修复:
raichu: { -
在 Chrome 和 Firefox 上运行良好。
标签: javascript ecmascript-2020