ES6计算属性

Posted by Song on March 14, 2019
let attrName = 'id';
let newObj = {
    [attrName]: '123'
};

等价于

let attrName = 'id';
let newObj = {};
newObj[attrName] = '123';