Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > Array Objects >
length Property
The length property returns a number representing the largest index of an array, plus 1.
Syntax
arrayName.length
Returns
The number of the largest index of the array, plus 1.
NOTE: This value does not necessarily represent the actual number of elements in an array, because elements do not have to be contiguous.
Usage
For example, suppose you had two arrays,
ant
andbee
, with the following elements:var ant = new Array; var bee = new Array;
ant[0] = 3 bee[0] = 88
ant[1] = 4 bee[3] = 99
ant[2] = 5
ant[3] = 6The length property of both ant and bee is equal to 4, even though ant has twice as many actual elements as bee does.
By changing the value of the length property, you can remove array elements. For example, if you change ant.length to 2, ant loses elements after the first two, and the values stored at the other indices are lost. If you set bee.length to 2, then bee consists of two members: bee[0], with a value of 88, and bee[1], with an undefined value.
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |