ES6 Common Issues

· 1 min read · 80 Words · -Views -Comments

The emergence of ES6 (ECMAScript2015) has brought new surprises to front-end developers. It contains some great new features that make it easier to implement many complex operations and improve developer efficiency. Since I use Node and Angular, I can directly use ES6. I encountered some issues during actual use, so I’m noting them here.

Adding Dynamic Keys to Objects

Use Computed Property Names

var key = 'DYNAMIC_KEY',
    obj = {
        [key]: 'ES6!'
    };

console.log(obj);
// > { 'DYNAMIC_KEY': 'ES6!' }
Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover