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
Links
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.
Required Knowledge
- `const` declaration (Block scope)
- basics (Object literal)
- computed properties (Object literal)
Related Katas
Global Object API
Object API
Object()
(as introduced in ES1)Object.is()
Object.fromEntries()
Object.fromEntries()
in depthObject.groupBy()
Object literal
- basics
- computed properties
- getter
- setter
Difficulty Level
BEGINNER
First Published
27 July 2015
Stats
4 tests to solve