Skip to content

meanOr

meanOr(array, fallback)

Returns the mean (average) value of the number array, or fallback if the array is empty.

ts
meanOr([1, 2, 3, 4], 0); // 2.5
ts
pipe([1, 2, 3, 4], meanOr(0)); // 2.5