Class Array


class Array
Extends the native Array class with the functions added in JavaScript 1.6.

For more information, please visit http://developer.mozilla.org.

Authors:
Henrik Lindqvist <henrik.lindqvist@llamalab.com>
Version:
Defined in Array.js

Function Summary
boolean every(function fn, [object thisp])
Tests whether all elements in the array pass the test implemented by the provided function.
Array filter(function fn, [object thisp])
Creates a new array with all elements that pass the test implemented by the provided function.
forEach(function fn, [object thisp])
Executes a provided function once per array element.
number indexOf(object e, [number i])
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
number lastIndexOf(object e, [number i])
Returns the last index at which a given element can be found in the array, or -1 if it is not present.
Array map(function fn, [object thisp])
Creates a new array with the results of calling a provided function on every element in this array.
boolean some(function fn, [object thisp])
Tests whether some element in the array passes the test implemented by the provided function.

Function Details

function every

boolean every(function fn, [object thisp])
Tests whether all elements in the array pass the test implemented by the provided function.
Parameters:
fn - function.
[thisp] - this for function.
Returns:
passed

function filter

Array filter(function fn, [object thisp])
Creates a new array with all elements that pass the test implemented by the provided function.
Parameters:
fn - function.
[thisp] - this for function.
Returns:
new Array

function forEach

forEach(function fn, [object thisp])
Executes a provided function once per array element.
Parameters:
fn - function.
[thisp] - this for function.

function indexOf

number indexOf(object e, [number i])
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
Parameters:
e - element.
[i] - start index.
Returns:
index or -1

function lastIndexOf

number lastIndexOf(object e, [number i])
Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards.
Parameters:
e - element.
[i] - start index.
Returns:
index or -1

function map

Array map(function fn, [object thisp])
Creates a new array with the results of calling a provided function on every element in this array.
Parameters:
fn - function.
[thisp] - this for function.
Returns:
new Array

function some

boolean some(function fn, [object thisp])
Tests whether some element in the array passes the test implemented by the provided function.
Parameters:
fn - function.
[thisp] - this for function.
Returns:
passed