Javascript Array Min/Max value


/ Published in: JavaScript
Save to your folder(s)

Get the min / max value from array.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.