mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-11 08:54:07 +03:00
e9ede74362
* Translate Simplified Chinese * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Supplement the omitted * Update docs/.vitepress/shared.mts --------- Co-authored-by: Sojin Park <raon0211@gmail.com>
414 B
414 B
mean
计算数字数组的平均值。
如果数组为空,则此函数返回 NaN
。
签名
function mean(nums: number[]): number;
参数
nums
(number[]
): 要计算平均值的数字数组。
返回值
(number
): 数组中所有数字的平均值。
示例
const numbers = [1, 2, 3, 4, 5];
const result = mean(numbers);
// result 将会是 3