This AI is still in early stages of development.
object.addConst()
- Aubergine
Owned by Aubergine
Add a hidden, read-only data property to any object...
Â
Syntax
obj.addConst(key, value);
Parameters
Parameter | Type | Mandatory | Description | Util.js version |
---|---|---|---|---|
key | String | The name (key) of the property. | 1.0 | |
value | Variant | The value associated with the property. | 1.0 |
Return value
Value | Type | Notes | API Version |
---|---|---|---|
<object> | Object | If successful, the addProp() method returns the modified object. | 1.0 |
<error> | TypeError | An error will be thrown if:
| 1.0 |
Example
Adding a property to an object...
myObj = {};  myObj.addConst("foo", "bar");  myObj.foo; // "bar"  myObj.foo = "moo"; // does nothing, foo is read-only  myObj.foo // "bar"  for (i in myObj) { // does not iterate foo (foo is hidden) }
Contents
Jump to:
Property Definitions
Topics:
- object.addAccessor() — Add a hidden, non-configurable accessor property to any object...
- object.addProp() — Adds a new accessor (getter/setter) or data (value) property to any object, setting it's enumerable, configurable and read-only flags as desired...
- ACCESSOR_HIDDEN_CONFIG — A non-enumerable, configurable accessor property.
- DATA_HIDDEN_CONFIG — A non-enumerable, configurable, writable data property.
- ACCESSOR_NORMAL — An enumerable, non-configurable accessor property.
- DATA_READONLY — An enumerable, non-configurable, read-only data property.
- DATA_READONLY_HIDDEN — A non-enumerable, non-configurable, read-only data property.
- ACCESSOR_HIDDEN — A non-enumerable, non-configurable accessor property.
- DATA_READONLY_CONFIG — An enumerable, configurable, read-only data property.
- ACCESSOR_NORMAL_CONFIG — An enumerable, configurable accessor property.
- DATA_NORMAL — An enumerable, non-configurable, writable data property.
- DATA_READONLY_HIDDEN_CONFIG — A non-enumerable, configurable, read-only data property.
- DATA_HIDDEN — A non-enumerable, non-configurable, writable data property.
- object.addConst() — Add a hidden, read-only data property to any object...
Â