X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript min() Method

Math Object Reference JavaScript Math Object

Example

Return the number with the lowest value:

Math.min(5,10);

The result will be:

5

Try it yourself »


Definition and Usage

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The min() method is supported in all major browsers.


Syntax

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

Parameter Values

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

Return Value

Type Description
Number The lowest number of the arguments, or -Infinity if no arguments are given, or NaN if one or more arguments are not numbers

Technical Details

JavaScript Version: 1.0


Example

Example

Return the number with the lowest value:

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);

The result of a,b,c,d, and e will be:

5
0
-5
-10
1.5

Try it yourself »


Math Object Reference JavaScript Math Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook