<script> // 对象字面量增强 const bar = “bar” const age = “age” const obj = { name: “tom”, // bar: bar bar, 属性名与属性值相同 省略掉:function不写 sayHi () { console.log(‘hi’) console.log(this) 指向的是obj }, // 计算属性名 [age]:18 [1+2]: 18 } 动态的属性名 // obj[age] = 18 console.log(obj) // obj.sayHi() </script>