[] (array access operator)
Top  Previous  Next


Syntax
myArray[n]

Arguments
Index of the array element to return.

Returns
Returns / allows access to the nth element of an array.

Description
Used to access the nth element of an array.
Note that all elements of the array should be initialised before access.

Sample
myArray = new Array;
myArray[0
] = "first";
myArray[1
] = "second";
myArray[2
] = "third";
n = 1
;
b = myArray[n];  // b now contains the value "second"