我用JS写了一段时间了,没有用过这种形式:
dist: {
files: {
[bpr + 'lib/Monster.min.js']: ['<%= concat.dist.dest %>']
}
}
}
[]:[]
它有效,我只是以前没有使用过或见过它。
最佳答案
最近才使用 ES6。它们被称为“计算属性名称”
来自MDN :
Starting with ECMAScript 2015, the object initializer syntax also supports computed property names. That allows you to put an expression in brackets
[]
, that will be computed as the property name.
关于javascript - 对象字面量中属性名称周围的方括号意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34831262/