API Docs for:
Show:

Array Class

Item Index

Methods

Methods

iterate

(
  • array
  • startIndex
  • incrementBy
  • iterationFunction
  • contextObject
)
Boolean static

Parameters:

  • array Array

    the array to iterate

  • startIndex Number

    (Optional) The first index to iterate. If left undefined, iteration will either start at the beginning of the array if incrementBy is positive or at the end of the array if incrementBy is negative.

  • incrementBy Number

    the interval by which the array will be iterated. Must be a non-zero integer. Negative values cause the array to be iterated backwards.

  • iterationFunction Function

    the function to call on each iteration. This function will receive three arguments: value, index, and array. If this function returns a truthy value, iteration will be terminated.

  • contextObject Object

    (Optional) the context that will become this in the iterationFunction

Returns:

Boolean: will return true if iteration was terminated early, otherwise it will return false.

unnest

(
  • array
  • levels
)
Array static

Utility function that flattens nested arrays. The original array is not modified. The returned array items are a shallow copy of the original array items.

Parameters:

  • array Array
  • levels Number

    Optional. If defined, must be a non-negative integer. Defaults to 1.

Returns: