콘텐츠로 이동
Search

JavaScript:ComputedPropertyName

Dictionary 의 Property 명에 리터럴이 아닌, 계산된 결과가 필요할 경우 사용한다. Property Name 에 [...]로 값을 넣는다.

Example

let obj = {
  [`key${func1(5,8)}`] : 'result is 13',
  [func2()] : 'hi'
}

See also

Favorite site

lastmod 2022-12-13created 2022-12-13author Zer0 sitemap