9592 shaares
235 private links
235 private links
Setting the property name into brackets give the ability to evaluate its value as an expression. Thus custom property names can be created:
let a = {
['foo' + 1]: i,
}
console.log(a.foo1) // print 1