mean
Calculates the arithmetic mean (average) of an array of numbers.
Returns NaN for an empty array.
Pairs with sum for aggregate operations.
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
array | readonly number[] | The array of numbers to average |
Returns
Section titled “Returns”number — The arithmetic mean, or NaN if the array is empty
Examples
Section titled “Examples”Average a list of numbers
Section titled “Average a list of numbers”Returns the arithmetic mean of the array; NaN for empty arrays.
