Skip to main content


Applies a function to all of an array’s items


Device + Agent


Name Type Description
function Function A data-manipulation function




This method applies the supplied function to every item in the target array, one by one, storing each result in place of the value that was used to generate it.

Contrast apply() with map() which doesn’t change the target array’s items but instead saves the results in a new array.

The passed function must include a single parameter into which each item in the target array is passed. It is the function’s job to make sure the array values passed are appropriate to the changes it will make, if any.

Example Code