It’s the new ES2015 (the EcmaScript spec formally known as ES6) computed property name syntax. It’s a shorthand for the someObject[someKey]
assignment that you know from ES3/5:
var a = "b"
var c = {[a]: "d"}
is syntactic sugar for:
var a = "b"
var c = {}
c[a] = "d"
More Related Contents:
- What does “this” refer to in arrow functions in ES6?
- `export const` vs. `export default` in ES6
- Javascript – arrow functions this in event handler?
- Arrow Functions and This [duplicate]
- Can you bind ‘this’ in an arrow function?
- How can I conditionally import an ES6 module?
- ES2015 import doesn’t work (even at top-level) in Firefox
- Getting Unexpected Token Export
- How can I access constants in the lib/constants.js file in Meteor?
- Deep copy in ES6 using the spread syntax
- How to create an instance of a subclass from the super class?
- How can I construct a Template String from a regular string? [duplicate]
- Javascript: What is the difference between Function and Class
- Why es6 react component works only with “export default”?
- How to publish a module written in ES6 to NPM?
- Best way to polyfill ES6 features in React app that uses create-react-app
- What is the defined execution order of ES6 imports?
- JSON stringify ES6 class property with getter/setter
- Why does the Promise constructor require a function that calls ‘resolve’ when complete, but ‘then’ does not – it returns a value instead?
- How to create new instance of an extended class of custom elements
- Get the description of a ES6 Symbol
- How to loop over object properties with ngFor in Angular
- How to create an array of objects from multiple arrays
- How should I import the Spatial Illusions milsymbol library into my webpage?
- Why is `throw` invalid in an ES6 arrow function?
- Where argument of first next() call goes? [duplicate]
- Unnecessary ‘else’ after ‘return’. (No-else-return)
- using await on global scope without async keyword
- ES6 arrow function and lexical scope inside a function [duplicate]
- ESLint: “error Parsing error: The keyword ‘const’ is reserved”