Function reduce

  • Reduces an array to a value which is the accumulated result of running each element in the array through the callback.

    Type Parameters

    • T
    • U

    Parameters

    • arr: T[]

      array to reduce

    • fn: ((acc, value, index, array) => U)

      callback to reduce the array

        • (acc, value, index, array): U
        • Parameters

          • acc: U
          • value: T
          • index: number
          • array: T[]

          Returns U

    • initial: U

      initial value

    Returns U

    the reduced value

Generated using TypeDoc