jskatas.org Continuously Learn JavaScript. Your Way.

Object literal: computed properties

Object literal properties may be computed values.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Object literal properties may be computed values

  • a computed property x needs to be surrounded by []
  • can also get a function assigned
  • the key may also be the result of a function call
  • the key can also be constructed by an expression
  • accessor keys can be computed names too