May 6, 2002 - Defining Constant Objects and Arrays
May 6, 2002 Defining Constant Objects and Arrays Tips: May 2002
Yehuda Shiran, Ph.D.
|
Object
or the Array
, only the reference to the data remains constant. The content of the Object
or the Array
can be changed. It allows you to keep the address of an object or an array fixed, and it also keeps you from deleting the reference to them. You can freely change the content of the object or each one of the array elements, but you cannot change the length of the array or the structure of the object. The following example declares an array of 12 objects of the Object
data type (ECMAScript Edition 3):
const arrayOfObjects : Object[] = new Object[12];
Anywhere in the application you can assign a value to an element of the array:
arrayOfObjects[7] = "contentOfEighthElement";
To learn more on JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.