Array

Extensions to the standard JavaScript Array class to add behavior.

Remarks

The following methods have been added by the framework to the Array prototype, to provide more consistency or improved functionality.

Methods

clearClears the array.
containsTests if the array contains the specified object.
firstGets the first object in an array.
getLengthReturns the length of the array.
indexOfGets the index in the array of the first occurrence of the specified object.
insertInserts the object at the specified index in the array.
lastGets the last object in an array.
removeRemoves the first occurrence of the object from the array.
removeAtRemoves the object at the specified index from the array.

Array clear method

Clears the array.

JavaScript

array.clear()

Array contains method

Tests if the array contains the specified object.

JavaScript

var boolVal = array.contains(obj)

Returns

true if obj is in the array, false otherwise.

Array first method

Gets the first object in an array.

JavaScript

var obj = array.first()

Returns

An object, or or null if the array is empty.

Array getLength method

Returns the length of the array.

JavaScript

array.getLength()

Array indexOf method

Gets the index in the array of the first occurrence of the specified object.

JavaScript

var intVal = array.indexOf(obj)

Returns

An integer index, or -1 if the obj isn't found.

Array insert method

Inserts the object at the specified index in the array.

JavaScript

array.insert(obj,index)

Array last method

Gets the last object in an array.

JavaScript

var obj = array.last()

Returns

An object, or null if the array is empty.

Array remove method

Removes the first occurrence of the object from the array.

JavaScript

var boolVal = array.remove(obj)

Returns

true if the object was found, false otherwise.

Array removeAt method

Removes the object at the specified index from the array.

JavaScript

array.removeAt(index)