Skip to content
Search

JavaScript:ComputedPropertyName

lastmod 2022-12-13created 2022-12-133 edits

Used when a Dictionary's Property name needs a computed result rather than a literal. Put the value in the Property Name with [...].

Example

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

See also

Favorite site

author Zer0 sitemap