title: What is the best way to get the minimum or maximum value from an Array of numbers?
body: <p>Let's say I have an Array of numbers: <code>[2,3,3,4,2,2,5,6,7,2]</code></p>
  
  <p>What is the best way to find the minimum or maximum value in that Array?</p>
  
  <p>Right now, to get the maximum, I am looping through the Array, and resetting a variable to the value if it is greater than the existing value:</p>
  
  <pre><code>var myArray:Array /* of Number */ = [2,3,3,4,2,2,5,6,7,2];
  
  var maxValue:Number = 0;
  
  for each (var num:Number in myArray)
  {
      if (num &gt; maxValue)
          maxValue = num;
  }
  </code></pre>
  
  <p>This just doesn't seem like the best performing way to do this (I try to avoid loops whenever possible).</p>