JavaScript Math.min()
Definition and Usage
The Math.min() method returns the number with the lowest value.
Tip: Math.max() returns the number with the highest value.
More Examples
Return the number with the lowest value:
let a = Math.min(5, 10);
let b = Math.min(0, 150, 30, 20, 38);
let c = Math.min(-5, 10);
let d = Math.min(-5, -10);
let e = Math.min(1.5, 2.5);
Try it Yourself »
Browser Support
Math.min()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
Math.min(n1, n2, n3, ..., nX)
Parameters
Parameter | Description |
---|---|
n1, n2, n3, ..., nX | Optional. One or more numbers to compare. |
Return Value
A number representing the lowest number of the arguments. Infinity if no arguments are given. NaN if one or more arguments are not a number. |