Array
Extensions to the standard JavaScript Array class to add behavior.
- Object
- Array
Remarks
The following methods have been added by the framework to the Array prototype, to provide more consistency or improved functionality.
Methods
clear | Clears the array. |
contains | Tests if the array contains the specified object. |
first | Gets the first object in an array. |
getLength | Returns the length of the array. |
indexOf | Gets the index in the array of the first occurrence of the specified object. |
insert | Inserts the object at the specified index in the array. |
last | Gets the last object in an array. |
remove | Removes the first occurrence of the object from the array. |
removeAt | Removes 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)