ES6 Common Issues

ES6 Common Issues

12月 12, 2017 · 1 分钟阅读时长 · 80 字 · -阅读 -评论

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!' }
Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源