JavaScript Object
Object
s can have any number values stored as
properties (specified by String
names or Symbol
s).
Instance Indexers
Returns the value stored in this at the specified propertyName
. This is the same as the
.
style access but also allows the property name to be specified at runtime using a String of being
hardcoded and allows access to properties that are invalid identifiers (such as including spaces or starting
with a number).
Example:
RunResults:
Instance Methods
Returns true
if this
has a property named propertyName
stored on it. This
method can be used to see if a property is set on the object, even if the value is set to undefined
.
Properties stored in the prototype chain do not count.
Example:
RunResults:
Returns true
if the property named propertyName
on this
is enumerable and
should be returned during a for (x in y)
loop.
Example:
RunResults:
Returns a locale specific (if possible) string representation of this
.
Example:
RunResults:
Object Methods
Returns a new Object
with prototype equal to prototype
. Pass null
for
prototype
to create an object with no prototype. Calls defineProperties(obj, propertyDescriptors)
with the new object if
propertyDescriptors
is specified.
Example:
RunResults:
For each property on propertyDescriptors
, defines a new property on obj
with the same
name and supplied PropertyDescriptor
. Returns obj
. See
also getOwnPropertyDescriptors()
.
Example:
RunResults:
Defines a new property with name equal to propertyName
on obj
with the supplied
descriptor. Returns obj
. See Reflect.defineProperty().
Example:
RunResults:
Returns an Array of key/value pairs for the properies of obj
. See also fromEntries(), keys(), and values().
Example:
RunResults:
For each property on obj
, sets its PropertyDescriptor.configurable
property to
false
and PropertyDescriptor.writable
property to false
. Also calls preventExtensions
on
obj
. Returns obj
.
Example:
RunResults:
Returns an object key-value pairs of the property name and PropertyDescriptor
s that describes
obj
. See also getOwnPropertyDescriptor
and create()
and defineProperties()
.
Example:
RunResults:
Returns an Array
of the symbols of properties set on obj
including those that are not
enumerable.
Example:
RunResults:
Returns false
if preventExtensions
was called on
obj
. A non-extensible object cannot have new properties added to it.
Example:
RunResults:
Returns an Array
containing the enumerable properties on obj
. See also getOwnPropertyNames()
, entries()
and values()
.
Example:
RunResults:
Same as preventExtensions
except it also sets each property as not
configurable
. Returns obj
.