ArrayMedian

Return the median value of an array.

Will only work on arrays that contain only numeric values.

Method Signature

ArrayMedian(array=[array])

Arguments

Argument
Type
Required
Description
Default

array

array

true

The array to get median value from

Examples

Calculates the Median value

Uses the arrayMedian function to calculate the Median value

Run Example

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

Result: 2

Additional Examples

aNames = array( 10412, 42, 33, 2, 999, 12769, 888 );
dump( arrayMedian( aNames ) );
// member function
dump( aNames.median() );

Last updated

Was this helpful?