The Array object's properties and methods are described below:
NN: Netscape, IE: Internet Explorer
Properties
Syntax: object.property_name
Property | Description | NN | IE |
---|---|---|---|
constructor | Contains the function that created an object's prototype | 4 | 4 |
length | Returns the number of elements in the array | 3 | 4 |
prototype | Allows you to add properties to an array | 3 | 4 |
Methods
Syntax: object.method_name()
Method | Description | NN | IE |
---|---|---|---|
concat() | Joins two or more arrays and returns a new array | 4 | 4 |
join(delimiter) | Puts all the elements of an array into a string separated by a specified delimiter (comma is default) | 3 | 4 |
pop() | Removes and returns the last element of an array | 4 | 5.5 |
push("element1","element2") | Adds one or more elements to the end of an array and returns the new length | 4 | 5.5 |
reverse() | Reverses the order of the elements in an array | 3 | 4 |
shift() | Removes and returns the first element of an array | 4 | 5.5 |
slice(begin[,end]) | Creates a new array from a selected section of an existing array | 4 | 4 |
sort() | Sorts the elements of an array | 3 | 4 |
splice(index,howmany[,el1,el2]) | Adds and/or removes elements of an array | 4 | 5.5 |
toSource() | Returns a string that represents the source code of the array | 4.06 | 4 |
toString() | Returns a string that represents the specified array and its elements | 3 | 4 |
unshift("element1","element2") | Adds one or more elements to the beginning of an array and returns the new length | 4 | 5.5 |
valueOf() | Returns the primitive value of an array | 4 | 3 |