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