An object literal can also contain setters
defining: a setter
by prefixing the property with set
(and make it a function)
must have exactly one parameter
can be a computed property (an expression enclosed in []
)
working with/on the setter
you can use delete
to remove the property (including it`s setter)
Links
Description of all the details of a setter.
"An accessor property associates a key value with one or two accessor functions ..."
The syntax definition of how to write an (accessor) method.
Announcement of this kata on twitter.
Required Knowledge
- `let` declaration (Block scope)
- `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
28 July 2015
Stats
4 tests to solve