JavaScript min() method
- Previous Page max()
- Next Page PI
- Go to the Previous Level JavaScript Math Reference Manual
Definition and usage
min()
The method returns the number with the smallest value.
Tip:max()
The method returns the number with the highest value.
Example
Example 1
The smallest number returned:
Math.min(5, 10);
Example 2
The smallest number returned:
var a = Math.min(5, 10); var b = Math.min(0, 150, 30, 20, 38); var c = Math.min(-5, 10); var d = Math.min(-5, -10); var e = Math.min(1.5, 2.5);
Syntax
Math.min(n1, n2, n3, ... , nX)
Parameter value
Parameter | Description |
---|---|
n1, n2, n3, ... , nX | Optional. One or more numbers to be compared. |
Technical details
Return value: |
A number, representing the minimum value in the argument.
|
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
min() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Mathematics
- Previous Page max()
- Next Page PI
- Go to the Previous Level JavaScript Math Reference Manual