Calculates the average of all numbers of an Iterable.
const result = avg([1,2,3]);console.log(result); // 2
reduce and sum for similar operations.
the average of all numbers, or undefined if Iterable was empty
undefined
the Iterable to average
Generated using TypeDoc
Calculates the average of all numbers of an Iterable.
Example
See
reduce and sum for similar operations.
Returns
the average of all numbers, or
undefinedif Iterable was empty