Syntax
median(array)
Description
The median() function returns the median (middle value) of the given data set. This method also sorts the data in ascending order before calculating the median.
If the number of data values is odd, it returns the exact middle value. If the number of data values is even, it returns the average of the two middle values.
Example
include("math") println(median([1, 3, 5, 7, 9, 11, 13])) println(median([1, 3, 5, 7, 9, 11])) println(median([-11, 5.5, -3.4, 7.1, -9, 22])) 7 6 1.05