title: JavaScript: Find object with Highest & Lowest
body: <p>This seemed pretty straight forward,so I was surprised when it did not work.  I am trying to find the object with the highest and lowest 'price'.  First, please confirm or correct my logic. If, the logic is correct, then please suggest what might be the problem.</p>
  
  <pre><code>var high;
  var low;
  var j=0;
  for (i in obj) {
      //alert(obj[i].price);
      if(j===0){
          high=obj[i].price; low=obj[i].price
      }else{
          if(obj[i].price &gt; high){high=obj[i].price}
          if(obj[i].price &lt; low ){low =obj[i].price}
      }
      alert("high: " + high +", low: " +low);
      j++;
  }
  </code></pre>
  
  <p>Note: This works fine: <code>for (i in obj) {</code> There is another portion of the script that cycles through the list perfectly and with this methodology. </p>