The simplest way to get the maximum (minimum) value in an array is to traverse the array and find its maximum (minimum) value through comparison. But in fact, some shortcut methods have been provided in the native methods of javascript to achieve this function.
1 Array.prototype.sort
var a = [7,3,4,6,10];
a.sort(function(a,b){
return (a-b);})
Note that the comparison function in sort must be passed in. If this function is not passed, the result of a.sort() is [10,3,4,6,7];
2 Math.max,Math.min
var a = [7,3,4,6,10];
var max = Math.max.apply(Math,a);
var min = Math.min.apply(Math,a);