This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Add a read-only, hidden data property to any object...

 

Syntax

obj.addConst(name, value);

Parameters

ParameterTypeMandatoryDescriptionUtil.js version
nameString(tick)

The name of the property.

1.0
valueVariant(tick)The value associated with the property.1.0

Return value

If a non-configurable property of the same name is already defined, an error will be thrown.

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)
}
Availability STABLE

Requires:

Contents

Jump to:

Property Definitions

Topics:

 

  • No labels