title: Get largest value in multi-dimensional array javascript or coffeescript
body: <p>I have an array that looks like the following:</p>
  
  <pre><code>array = [[1, 5], [4, 7], [3, 8], [2, 3],  
   [12, 4], [6, 6], [4, 1], [3, 2], 
   [8, 14]]
  </code></pre>
  
  <p>What I need is the largest number from the first value of the sets, so in this case <code>12</code>.
  Looking at some examples online, the best way I saw to accomplish this is : </p>
  
  <pre><code>Math.max.apply Math, array
  </code></pre>
  
  <p>Problem is, this only works with single dimensional arrays. How would I impliment this for my senario? (jquery allowed)</p>
  
  <hr>
  
  <p><strong>The end solution:</strong></p>
  
  <p>It wasn't part of the question, but I needed both the min and max from the array, and that changes things a little.</p>
  
  <pre><code>    unless device.IE
          justTheDates    = magnitudeArray.map (i) -&gt; i[0]
          @earliest       = Math.min.apply Math, justTheDates
          @latest         = Math.max.apply Math, justTheDates                 
      else
          @earliest       = magnitudeArray[0][0]
          @latest         = magnitudeArray[0][0]
          for magnitudeItem in magnitudeArray
              @earliest   = magnitudeItem[0] if magnitudeItem[0] &lt; @earliest
              @latest     = magnitudeItem[0] if magnitudeItem[0] &gt; @latest
  </code></pre>