Kirupa.com - Finding Maximum/Minimum Value in an Array

I was a bit dismayed to find out that Flash had no simple built-in way of getting the maximum value from an array. You have Math.max(), but that function returns only the greater of two values. The Array.sort and Array.sortOn methods were too complicated for me to fiddle with, and when I thought I had them working, they didn't produce the right results.


This is a companion discussion topic for the original entry at http://www.kirupa.com/developer/actionscript/array_max_min.htm