step()

Allows for an array or an array-like structure to be stepped through in the order specified after each iteration.

This function is valid in v2.21.0 to v2.24.3. This function has been downloaded 38 times.

Parameters

{Array} array
Array or array-like object to step through.
{number=} opt_stepValue Optional, Default:1
If given this will indicate the amount by which to increase the index of the value to be checked next. For example, if you always want to traverse an array backwards you can supply -1.
{Function=} opt_callback Optional
If not given opt_stepValue will be the only value used for the step value. If given this function will be called on each iteration. This will be passed (1) the value, (2) the index of the value and (3) array. The return value will be used as the new step value. If nothing, undefined or null is returned then opt_stepValue will be used as the next step value.
{number=} opt_startIndex Optional
If not given this will default to array.length - 1 if opt_stepValue is -1, otherwise this will default to 0. This represents the starting index.

Returns

{Array}
An array of the values found in the indices that were traversed.