title: Chrome: How to solve "Maximum call stack size exceeded" errors on Math.max.apply( Math, array )
body: <p>I have to find the maximum and minimum value of very huge arrays. For this I'm using</p>
  
  <pre><code>Math.max.apply(Math, my_array);
  Math.min.apply(Math, my_array);
  </code></pre>
  
  <p>It works good on Firefox and IE, but on Chrome I always get <code>Maximum call stack size exceeded</code> errors... my current array has 221954 elements, and that's not my biggest.</p>
  
  <p>Does someone know how to solve this error on Chrome? How can I optimize the search of max and min value?</p>
  
  <p>For those people who can't believe, try this in the console of Chrome:</p>
  
  <pre><code>var xxx = []
  for(var i=0; i&lt;300000; i++){
      xxx.push(Math.random());
  }
  Math.max.apply(Math, xxx);
  </code></pre>
  
  <p>---> RangeError: Maximum call stack size exceeded</p>