JavaScript Math.min()

Example

let x = Math.min(5, 10);
Try it Yourself »

More Examples

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 »

Description

The Math.min() method returns the number with the lowest value.



Syntax

Math.min(n1, n2,...)

Parameters

Parameter Description
n1, n2,... Optional.
One or more numbers to compare.

Return Value

Type Description
NumberThe lowest number of the arguments.
Infinity if no arguments are given.
NaN if one of the arguments is not a number.


Browser Support

Math.min() is an ECMAScript1 (ES1) feature.

ES1 (JavaScript 1997) is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.