min()
Math
class method
JS Home <<
JS Reference <<
Math <<
min()
Description
Returns the smallest of some numbers.
- Like all class methods
min()
should be used on the class rather than an instance of the class.
Syntax
Signature | Description |
---|---|
Math.min( [value1 [,value2[,...valueN]]]) | Returns the smallest of some numbers. |
Parameters
Parameter | Description |
---|---|
value1, value2, ...valueN | The values you wish to find the smallest number of: |
Examples
The code below displays min()
usage.
// Store results in an array.
var minValues = new Array(6);
minValues[0] = Math.min(1.9, 1.6, 1.90001);
minValues[1] = Math.min(-10.8, -10.6, -10.59);
minValues[2] = Math.min('100.1', '100.2', '101');
minValues[3] = Math.min('five', 6, 7);
minValues[4] = Math.min();
minValues[5] = Math.min(null, null);
alert(minValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 4 - Math