Calculates the average of the values in an array.
All elements in the array must contain values that can be
automatically converted to numeric.

arrayAvg(array) → returns numeric

Member Function Syntax


arrayAvg Argument Reference

array array

An array which to determine average

Examples sample code invoking the arrayAvg function

Average value of an array

Uses the arrayAvg function to get average value of an array

numberArray = [1,2,3];

Expected Result: 2

Average value of an array using the Array member function

CF 11+ Lucee 4.5+ Uses the avg member function is the same as running arrayAvg.

numberArray = [1,2,3];

Expected Result: 2

Fork me on GitHub