Js gets the sample code for the maximum and minimum values of an array


When doing a project encountered a return query content, only the maximum and minimum value problem.

First of all,



Array.max=function(array)
{
return Math.max.apply(Math,array);
}


Array.min=function(array)
{
return Math.min.apply(Math,array);
}

call


//Handle ordinate adaptive --start
var yData = data.rows[i];
var yMin = Array.min(yData);//Minimum ordinate
var yMax = Array.max(yData);//Vertical maximum