Function sum

  • Computes the sum of the values in array.

    Parameters

    • array: ArrayLike<number>

      The array to iterate over.

    Returns number

    Returns the sum.

    Since

    5.6.0

    Example

    sum([4, 2, 8, 6])
    // => 20