Category
Get the arithmetic mean of an array of numbers.
number
Time complexity: O(n)
Space complexity: O(1)
The array to calculate the mean of
The mean of the array
Math
const array = [1, 2, 3];mean(array); // 2 Copy
const array = [1, 2, 3];mean(array); // 2
Get the arithmetic mean of an array of bigints.
bigint
const array = [1n, 2n, 3n];mean(array); // 2n Copy
const array = [1n, 2n, 3n];mean(array); // 2n
Get the arithmetic mean of an array of
number
s.Time complexity: O(n)
Space complexity: O(1)