Math.min( [ value1 ], [ value2 ], [ ... ] ) in ECMAScript 262
Return the smallest of all arguments supplied.
Arguments
name | type | description |
---|---|---|
value1 | Number | [optional] The first value. |
value2 | Number | [optional] The second value. |
... | Number | [optional] etc. |
- Return Type
- Number
Description
If any of the arguments are not numbers, an attempt is made to convert them to numbers. If this attempt fails, the result will be NaN
.
var smallest = Math.min( 1 , 17 , '5', -0.4 , 18 , 3.1 );
// ** smallest is -0.4
var failedAttempt = Math.min( 10 , 'bee' );
// ** failedAttempt is NaN
If no arguments are supplied, the return value is Math.POSITIVE_INFINITY
.