A property descriptor can be of two types: data descriptor, or accessor descriptor.
Data descriptor
Mandatory properties:
Optional properties:
configurable
enumerable
writable
Sample:
{
value: 5,
writable: true
}
Accessor descriptor
Mandatory properties:
- Either
get
or set
or both
Optional properties:
Sample:
{
get: function () {
return 5;
},
enumerable: true
}