Find min and max of an array





9
Date Submitted Wed. Aug. 16th, 2006 9:33 PM
Revision 1 of 1
Syntax Master sundaramkumar
Tags JavaScript
Comments 0 comments
Find min and max of an array


Array.prototype.max = function(){
        return Math.max.apply({},this)
}
Array.prototype.min = function(){
        return Math.min.apply({},this)
}


 
For example alert(yourarray.max()) will display the max of yourarray

Comments

There are currently no comments for this snippet.

Voting