min()  Math  class method JS Home  <<  JS Reference  <<  Math  <<  min()

Description

Returns the smallest of some numbers.

  • Like all class methods min() should be used on the class rather than an instance of the class.

Syntax

Signature Description
Math.min( [value1 [,value2[,...valueN]]])Returns the smallest of some numbers.

Parameters

Parameter Description
value1, value2, ...valueNThe values you wish to find the smallest number of:
  • Non-numeric strings returns NaN.
  • Passing no parameter returns NaN.
  • Passing null returns 0.

Examples

The code below displays min() usage.


// Store results in an array.
var minValues = new Array(6);

minValues[0] = Math.min(1.9, 1.6, 1.90001);
minValues[1] = Math.min(-10.8, -10.6, -10.59);
minValues[2] = Math.min('100.1', '100.2', '101');
minValues[3] = Math.min('five', 6, 7);
minValues[4] = Math.min();
minValues[5] = Math.min(null, null);

alert(minValues);  

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 4 - Math

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Math

Class Properties
E
LN2
LN10
LOG2E
LOG10E
PI
SQRT1_2
SQRT2
Instance Properties
None.
Class Methods
abs()
acos()
asin()
atan()
atan2()
ceil()
cos()
exp()
floor()
log()
max()
min()
pow()
random()
round()
sin()
sqrt()
tan()
Instance Methods Getters
None.
Instance Methods Setters
None.

Statements

Operators