title: Best algorithm for determining the high and low in an array of numbers?
body: <p>I am using pseudo-code here, but this is in JavaScript. With the most efficient algorithm possible I am trying to find the high and low given an array of positive whole numbers. This is what I came up with, but I don't think it is probably best, and was just wondering if anyone has any other suggestions.</p>
  
  <pre><code>var low = 1;
  var high = 1;
  for ( loop numbers ) {
      if ( number &gt; high ) {
          high = number;
      }
      if ( low == 1 ) {
          low = high;
      }
      if ( number &lt; low ) {
          low = number;
      }
  }
  </code></pre>