develop wherever and whenever you want...
Docs > Array Class Summary

Array Class Summary

The array class is used to construct array objects and provides methods on all arrays.

array Array([count]) 
Construct an array. If count is not supplied, the array is returned but has no elements.

string toString() 
Return a string containing each element of the array separated by a comma ','.

string join(separator) 
Return a string containing each element of the array separated by the provided separator.

string join(separator) 
Return a string containing each element of the array separated by the provided separator.

array concat(other) 
Return an array combinging this array with another array.

value pop() 
Return the last value in the array and shrink the array size by 1.

void push(value[,value,value…]) 
Add one or more value to the array and grow it to accomodate the added content.

void reverse() 
Reverse all elements in this array.

value shift() 
Remove and return the first element in the array.

array slice(start,end) 
Return an array containing the elements of this array from start up to (but not including) end.

void sort([compare]) 
Sort the array. An optional function can be passed which is called with two values and should return true if the first parameter is greater than the second.

array splice(start,count[,item,item…]) 
Remove count elements from this array at start. If start is less than zero, it is assumed to be negative offset from the length of this array. Optional items can be added back at the start position.

number unshift(item[,item,item…]) 
Insert set of items at the begining of this array and return the new length.

array map(function[,other]) 
Call the function passing in the value and index of the array and put the return result into the same index at the returned array. If other is supplied, the function is called as a method on it as an object.

void forEach(function[,other]) 
Call the function supplied passing in the element and index of element for all elements in this array. If other is supplied, the function is called as a method on the other object.