オブジェクトのキーを角カッコ[brackets]で囲う記法

(式と演算子)
https://tech-1natsu.hatenablog.com/entry/2019/04/17/004536
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names

名称は “Computed Property Names”。MDNだと日本語訳で『計算されたプロパティ名』となっている。
ちなみにES2015から実装されたシンタックスである。
オブジェクトのキー名を変数から参照したい場合に便利。
また、キーから直接メソッドを呼んだりもできる。

const name = 'Rose'
const age = 23
const profile = {
  [name.toUpperCase()]: age // 大文字にしたい
}
// profile => {ROSE: 23}

function getKey(k) {
  return `a key named ${k}`;
}

const obj = {
  id: 5,
  name: 'San Francisco',
  [getKey('enabled')]: true,
};
// {id: 5, name: "San Francisco", a key named enabled: true}
inserted by FC2 system