Java Reference
In-Depth Information
Methods
Method
introduced
description
concat(value1 [,
value2,...])
JavaScript 1.2
Concatenates two arrays and returns the new
array thus formed.
every(testFn(element,
index, array))
JavaScript 1.6
Iterates over the array, executing
testFn()
on every element. Returns
true
if all iterations
return
true
. Otherwise, it returns
false
.
filter(testFn(element,
index, array))
JavaScript 1.6
Iterates over the array, executing
testFn()
on every element. Returns a new array of
elements that pass
testFn()
.
foreach(fn(element,
index, array))
JavaScript 1.6
Iterates over the array, executing
fn()
on
every element.
indexOf(element [,
startIndex])
JavaScript 1.6
Returns an index of the specified element
if found, or
‐1
if not found. Starts at
startIndex
if specified.
JavaScript 1.1
Joins all the elements of an array into a single
string delimited by a separator if specified.
join([separator])
lastIndexOf(element[,
startIndex])
JavaScript 1.6
Searches an array starting at the last element
and moves backwards. Returns an index of
the specified element if found, or
-1
if not
found. Starts at
startIndex
if specified.
map(fn(element, index,
array))
JavaScript 1.6
Iterates over the array, executing
fn()
on
every element. Returns a new array based on
the outcome of
fn()
.
JavaScript 1.2
Pops the last element from the end of the
array and returns that element.
pop()
push(value1 [, value2,
...])
JavaScript 1.2
Pushes one or more elements onto the end
of the array and returns the new length of the
array. The array's new
length
is returned.
JavaScript 1.1
Reverses the order of the elements in the
array, so the first element becomes the last
and the last becomes the first.
reverse()
JavaScript 1.2
Removes the first element from the beginning
of the array and returns that element.
shift()
slice(startIndex [,
endIndex])
JavaScript 1.2
Returns a slice of the array starting at the start
index and ending at the element before the
end index.
continues