Math.min()

Returns the smallest of the given numbers.

Since ES1 Spec ↗

Syntax

Math.min(...values)

Parameters

NameTypeRequiredDescription
values number No Zero or more numbers to compare.

Returns

number — The smallest argument, Infinity if none given, or NaN if any argument is NaN.

Examples

console.log(Math.min(4, 1, 8));
Output
1
console.log(Math.min(...[7, 2, 9]));
Output
2

Notes

With no arguments returns Infinity. Any non-numeric/NaN argument makes the result NaN. Combine with `Math.max` to clamp: `Math.min(hi, Math.max(lo, x))`.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12
node 0.10

See also