Returns the smaller of two numbers.
Method of Math
Static
Syntax
min( x, y )
Parameters
Parameter | Description |
---|---|
x, y | Numbers. |
Description
Because min is a static method of Math, you always use it as Math.min(), rather than as a method of a Math object you created.
Examples
The following function evaluates the variables x and y:
If you pass getMin the values 10 and 20, it returns 10; if you pass it the values -10 and -20, it returns -20.