A-C > Array.length

 

Array.length

Availability

Flash Player 5.

Usage

myArray.length

Description

Property; contains the length of the array. This property is automatically updated when new elements are added to the array. When you assign a value to an array element (for example, myArray[index] = value), if index is a number, and index+1 is a greater than the length property, the length property is updated to index + 1.

Example

The following code explains how the length property is updated.

// initial length is 0
myArray = new Array();
myArray[0] = 'a';
// myArray.length is updated to 1
myArray[1] = 'b';
// myArray.length is updated to 2
myArray[9] = 'c';
// myArray.length is updated to 10