Posted By

mihael on 06/30/10


Tagged

javascript array max min


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

kele5240


Javascript Array Min/Max value


 / Published in: JavaScript
 

Get the min / max value from array.

  1. var my_array = new Arra("10","20","5");
  2.  
  3. Array.max = function( array ){
  4. return Math.max.apply( Math, array );
  5. };
  6.  
  7. Array.min = function( array ){
  8. return Math.min.apply( Math, array );
  9. };
  10.  
  11. // use like: var biggestValue = Array.max(my_array);

Report this snippet  

You need to login to post a comment.