JavaScript (ES2026) reference · Math Methods and Constants

JavaScript Math.min() Method

Return the smallest of the given numbers. Use spread to find the smallest value in an array.

JavaScript (ES2026) Since ES1

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Math.min(value1, value2, /* …, */ valueN)

Parameters

ParameterDescription
values Numbers to compare.

Return value

The smallest number, Infinity with no arguments.

Examples

Smallest valueTry it yourself
console.log(Math.min(3, 9, 4), Math.min(...[7, 2, 5]));

Output

3 2
Clamp a value to a rangeTry it yourself
const clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
console.log(clamp(150, 0, 100), clamp(-5, 0, 100), clamp(42, 0, 100));

Output

100 0 42

Version history

VersionChange
JavaScript ES1Added

In other languages

Was this page helpful?