length Property (Array)
Returns an integer value one higher than the highest element defined in an array.
- Required. Any Array object.
As the elements in a JScript array do not have to be contiguous, the length property is not necessarily the number of elements in the array.
If a value smaller than its previous value is assigned to the length property, the array is truncated, and any elements with array indexes equal to or greater than the new value of the length property are lost.
If a value larger than its previous value is assigned to the length property, the array is formally expanded, but no new elements are created.
The following example illustrates the use of the length property. An array is declared, and two elements are added to it. Since the largest index in the array is 6, the length is 7.
var my_array : Array = new Array(); my_array = "Test"; my_array = "Another Test"; print(my_array.length); // Prints 7.
Applies To: Array Object