ts-playground
    Preparing search index...

    Variable averageConst

    average: (values: number[], defaultValue?: number) => number = arithmeticMean

    Average of all values in the array (alias of arithmeticMean) If the array is empty, it returns 0 or the defaultValue

    Type declaration

      • (values: number[], defaultValue?: number): number
      • Arithmetic mean (average) of all values in the array If the array is empty, it returns 0 or the defaultValue

        Parameters

        • values: number[]
        • OptionaldefaultValue: number

        Returns number

        average of all values

        import { average } from '@kitsuyui/mymath'
        average([1, 2, 3, 4]) // => 2.5
    import { average } from '@kitsuyui/mymath'
    average([1, 2, 3, 4]) // => 2.5

    average of all values