The minimum value function in JavaScript is: the min() function of the Math object; use this method to return the number with the minimum value in the specified number list, the syntax "Math.min(n1,n2,n3 ,...,nX)”.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
In JavaScript, if you want to ask for the minimum value, you can use Math.min()
.
Give a chestnut:
console.log(Math.min(5,10)); console.log(Math.min(0,150,30,20,38)); console.log(Math.min(-5,10)); console.log(Math.min(-5,-10)); console.log(Math.min(1.5,2.5));
Look at the output:
Description:
Math object The min() method returns the number with the smallest value among the specified numbers.
Syntax: Math.min(n1,n2,n3,...,nX)
Return value: the smallest value among the parameters. If there are no parameters, Infinity is returned. If an argument is NaN, or a non-numeric value that cannot be converted to a number, NaN is returned.
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What is the JavaScript minimum function?. For more information, please follow other related articles on the PHP Chinese website!