Array.max = function( array ){
return Math.max.apply( Math, array );
};
Array.min = function( array ){
return Math.min.apply( Math, array );
};
By using JavaScript's .apply() method on a built-in function you can pass in an array of unlimited arguments.
Shannon Norrell