> a = 'k'
'k'
> {[a]: 1}
{ k: 1 }
这段代码是在babel-node
里面跑的,查遍了文档也没有找到(文档里面肯定有)
1
gxm44 2016-03-02 14:50:09 +08:00 1
These are called "computed property names".
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names |
2
djyde 2016-03-02 14:51:16 +08:00 1
|
3
agate 2016-03-02 14:54:14 +08:00
楼上正解~
|