title: Math.max method on array with equal values
body: <p>I'm working on some coderbyte code, and noticed that when I try to get the max item in an array of equal values <code>undefined</code> is returned.  When logging the min value is logs <code>80</code> and not <code>undefined</code>.  Why is this?</p>
  
  <p>Updated Code:</p>
  
  <pre><code>function noRepeat(arr) {
      tmp = []
      if (arr.length === 2 &amp;&amp; arr[0] === arr[1]) {
          return arr;
      }
      for (var i = 0;i&lt;arr.length;i++) {
          if (tmp.indexOf(arr[i]) === -1) {
              tmp.push(arr[i])
          }
      }
      return tmp
  }
  function SecondGreatLow(arr) {
      arr = noRepeat(arr).sort(function (a,b) {return a-b;});
      var low = arr[arr.indexOf(Math.min.apply(Math,arr))+1];
      console.log("low",low);
      var high = arr[arr.indexOf(Math.max.apply(Math,arr))-1];
      console.log("high",high);
      return low +" "+high;
  }
  console.log(SecondGreatLow([80,80]));
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>"low" 80 
  "high" undefined
  "80 undefined"
  </code></pre>