JavaScripture
Contribute via GitHub Feedback

PropertyDescriptor : Object

A PropertyDescriptor describes a property on an Object. Any JavaScript object can be used as a PropertyDescriptor where unspecified properties will be treated as undefined or false.

Instance Properties

configurable : Boolean

Set to true if the property descriptor can be changed later. See the Object.freeze() and Object.seal() methods for ways to set configurable to false on all properties on an object.

Example:

Run

Results:

 

enumerable : Boolean

Set to true if the property is accessed during for (propertyName in object). See the Object.propertyIsEnumerable() method.

Example:

Run

Results:

 

get : getFunction
getFunction() : Object

The getter function that returns the value for the property. Use set to specified the setter function. If get or set functions are specified, value and writable cannot be specified.

Example:

Run

Results:

 

set : setFunction
setFunction(value : Object) : undefined

The setter function that is called when setting the property. Use get to specified the getter function. If get or set functions are specified, value and writable cannot be specified.

Example:

Run

Results:

 

value : Object

The value stored in the property. value can only be specified if both get and set functions are not specified.

Example:

Run

Results:

 

writable : Boolean

Set to true if the property can be modified, false otherwise. writable can only be specified if both get and set functions are not specified.

Example:

Run

Results: