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 number

Member Function Syntax

array.median()

This function requires Lucee. Not supported on Adobe ColdFusion.

arrayMedian Argument Reference

array
Required

Examples sample code invoking the arrayMedian function


Calculates the Median value

Uses the arrayMedian function to calculates the Median value

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

Expected Result: 2


Fork me on GitHub