/

HTML / CSS / JavaScript Tutorial

JavaScript Math method: min()

[this page | pdf | back links]

The min() method (of the Math object) returns the minimum of a set of real numbers.

 

It has the following syntax with the following parameters:

 

Math.min(x1, x2, x3, …)

 

Parameter

Required / Optional

Description

x1, x2, x3, …

Required

Input values

 

You can find the minimum of an array using a format such as:

 

Math.min.apply(null, xarray)

 

since e.g. Math.min.apply(null, [1, 2, 3]) is equivalent to Math.min(1, 2, 3)

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Numbers and Math


Desktop view | Switch to Mobile