mean es-toolkit
Calculates the average of an array of numbers.
Usage
mean(nums)
Use mean when you want to find the average value of an array of numbers. It calculates the average by adding all numbers together and dividing by the length of the array. If given an empty array, it returns NaN.
Parameters
numsreadonly number[]required
An array of numbers to calculate the average.
Returns
Returns the average of all numbers in the array. Returns NaN if the array is empty.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.