forEach(callback, thisp?)

Calls the callback for each entry in the collection.

The given callback receives the value for each entry, the key or index, and the collection itself. It is not obliged to return anything, and forEach returns nothing.

The iteration of lists is resilient to changes to the list during iteration. Nodes added after the current node will be visited. Nodes removed before the current node will not affect subsequent iterations.

If this collection is an array with holes, those entries will not be visited.

On collections

Usage

  • forEach(callback)
  • forEach(callback, thisp)

Related

  • reduce(callback, basis)

    Aggregates every value in this collection with the result collected up to that index.

  • map(callback, thisp?)

    Returns an array of the respective return values of a callback for each entry in this collection.

  • filter(callback, thisp?)

    Returns an array with each value from this collection that passes the given test.

  • group(callback, thisp?, equals?)

    Returns an array of [key, class] entries where every value from the collection is placed into the same equivalence class if they return the same key through the given callback.