jskatas.org Continuously Learn JavaScript. Your Way.

Object literal: getter

A getter binds an object property to a function that will be called when that property is looked up.

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.

An object literal can also contain getters

  • just prefix the property with get (and make it a function)
  • must have NO parameters
  • can be a computed property (an expression enclosed in [])
  • can be removed using delete


Description of all the details of a getter.
"An accessor property associates a key value with one or two accessor functions ..."
Announcement of this kata on twitter.