Function reduceRight

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

    Type Parameters

    • T

    Parameters

    • array: T[]

      The collection to iterate over.

    • iteratee: Reducer<T, T>

      The function invoked per iteration.

    Returns T | undefined

    Returns the accumulated value.

    0.1.0

    reduce

    const array = [[0, 1], [2, 3], [4, 5]]

    reduceRight(array, (flattened, other) => flattened.concat(other), [])
    // => [4, 5, 2, 3, 0, 1]
  • Type Parameters

    • T
    • TResult

    Parameters

    Returns TResult