const name = 'hao'; const age = 30; const man = { //es6对象的省略写法 name, age } console.log(man); let person = { price:20, alls() { console.log(111); }, on:()=>{ console.log(111); } } person.alls(); console.log(person.price); person.on();
结果:
const name = 'hao'; const age = 30; const man = { //es6对象的省略写法 name, age } console.log(man); let person = { price:20, alls() { console.log(111); }, on:()=>{ console.log(111); } } person.alls(); console.log(person.price); person.on();
结果: