Function arrAverage

  • Calculates the average of an array of numbers.

    Parameters

    • array: number[]

      The array of numbers.

    Returns number

    The average of all numbers in the array.

    Throws

    an error if the input array is empty.

    Example

    const numbers = [1, 2, 3, 4, 5];
    arrAverage(numbers);
    //=> 3

Generated using TypeDoc