average()

Returns the arithmetic mean of the collection, by computing its sum and the count of values and returning the quotient.

The optional zero argument is the initial value for both the sum and count, and defaults to 0.

Note that for arrays with holes, the count is distinct from the length.

On collections

Usage

  • average()
  • average(zero)