Function: meanAsync()
meanAsync(
asyncIterable
):Promise
<number
>
Returns a promise that resolves to the mean of the numbers of
asyncIterable
.
Returns a promise that resolves to NaN
for an empty async iterable.
Parameters
• asyncIterable: AsyncIterable
<number
, any
, any
>
Returns
Promise
<number
>
Example
console.log(await meanAsync(asAsync([1, 4, 6, 2])))
//=> 3.25
console.log(await meanAsync(emptyAsync))
//=> NaN