Built-In Namespace Array
Method Attributes | Method Name and Description |
---|---|
each(f)
Apply a method to each member of an array
|
|
find(match)
|
|
map(f)
|
|
reduce(op, initial)
Apply a method to initial and the first value of the array, then to the result and the second, and
so on.
|
Method Detail
each(f)
Apply a method to each member of an array
Defined in: utility.js.
Defined in: utility.js.
- Parameters:
- f
- - A function taking a single value and returning a value
find(match)
Defined in: utility.js.
- Parameters:
- match
map(f)
Defined in: utility.js.
- Parameters:
- f
reduce(op, initial)
Apply a method to initial and the first value of the array, then to the result and the second, and
so on. For example, to sum the array, you could use:
[1, 4, 7].reduce(function(a,b) { return a+b }, 0)
Defined in: utility.js.
Defined in: utility.js.
- Parameters:
- op
- function to apply. It should take two parameters
- initial
- Initial value. If left out, it won't be used