ES6支持对象属性为变量,的写法: var a = 'x' var b = 'y' var obj = { [a]: 'this is x', [b]: 'this is y', } console.log(obj)