jquery find highest value in array 1

jquery find highest value in array

var _array = [1,3,2];
Math.max.apply(Math,_array);

Here is what the above code is Doing:
1. The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).
2. The Math.max() function returns the largest of zero or more numbers.
3. The apply() method calls the Math.max() function with the this value set to Math, and the array [1,3,2] as the arguments.
4. The Math.max() function returns the largest of the numbers 1, 3, and 2, which is 3.

Similar Posts