javascript - What do square brackets around a property name in an object literal mean? -


i've been writing in js while , have not used form:

  dist: {     files: {       [bpr + 'lib/monster.min.js']: ['<%= concat.dist.dest %>']     }   } } 

the

[]:[] 

it works, have not used or seen before.

only es6. called "computed property names"

from mdn:

starting ecmascript 2015, object initializer syntax supports computed property names. allows put expression in brackets [], computed property name.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -