Built-In Class Array
The built-in Array class.
Method Attributes | Method Name and Description |
---|---|
filter(f, o)
Creates a new array with all elements that pass the test implemented by the
provided function.
|
|
forEach(f, o)
Executes a provided function once per array element.
|
|
map(f, o)
Creates a new array with the results of calling a provided function on every
element in this array.
|
|
reduce(f, v)
Apply a function against an accumulator and each value of the array (from
left-to-right) as to reduce it to a single value.
|
Method Detail
filter(f, o)
Creates a new array with all elements that pass the test implemented by the
provided function. Implemented in Javascript 1.6.
- Parameters:
- {function} f
- function to test each element of the array.
- o Optional
- object to use as this when executing f.
- See:
- filter documentation.
forEach(f, o)
Executes a provided function once per array element. Implemented in
Javascript 1.6.
- Parameters:
- {function} f
- function to execute for each element.
- o Optional
- object to use as this when executing f.
- See:
- forEach documentation.
map(f, o)
Creates a new array with the results of calling a provided function on every
element in this array. Implemented in Javascript 1.6.
- Parameters:
- {function} f
- function that produces an element of the new Array from an element of the current one.
- o Optional
- object to use as this when executing f.
- See:
- map documentation.
reduce(f, v)
Apply a function against an accumulator and each value of the array (from
left-to-right) as to reduce it to a single value. Implemented in Javascript
1.8.
- Parameters:
- {function} f
- function to execute on each value in the array.
- v Optional
- object to use as the first argument to the first call of t.
- See:
- reduce documentation.