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
someArray.avg()
Name | Type | Required | Default | Description |
---|---|---|---|---|
array | array | Yes | An array which to determine average |
Uses the arrayAvg function to get average value of an array
numberArray = [1,2,3];
writeOutput(arrayAvg(numberArray));
CF11+ Lucee4.5+ Uses the avg member function is the same as running arrayAvg.
numberArray = [1,2,3];
writeOutput(numberArray.avg());