arrayMedian

Calculates the Median value of items in an array. All elements in the array must contain values that can be converted to numeric.

arrayMedian(array) → returns numeric

Member Function Syntax

array.median()

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

array array
Required

Examples
Sample code invoking the arrayMedian function

Uses the arrayMedian function to calculates the Median value

someArray = [1,2,2];
m=arrayMedian(someArray);
writeOutput(m);

Expected Result: 2

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub