Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Add a hidden, read-only , hidden data property to any object... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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) } |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Property DefinitionsTopics:
|