Function forEachRight

  • This method is like forEach except that it iterates over elements of collection from right to left.

    Type Parameters

    • T

    Parameters

    • Optionalcollection: ArrayLike<T>

      The collection to iterate over.

    • Optionaliteratee: ArrayIteratee<T, void>

      The function invoked per iteration.

    Returns void

    Returns collection.

    5.13.0

    eachRight

    [[forEach]], [[forIn]], [[forInRight]], [[forOwn]], [[forOwnRight]]

    forEachRight([1, 2], value => console.log(value))
    // => Logs `2` then `1`.
  • This method is like forEach except that it iterates over elements of collection from right to left.

    Type Parameters

    • T

    Parameters

    • Optionalcollection: PlainObject<T>

      The collection to iterate over.

    • Optionaliteratee: RecordIteratee<T, void>

      The function invoked per iteration.

    Returns void

    Returns collection.

    5.13.0

    eachRight

    [[forEach]], [[forIn]], [[forInRight]], [[forOwn]], [[forOwnRight]]

    forEachRight([1, 2], value => console.log(value))
    // => Logs `2` then `1`.