JavaScript max() method
- Previous Page LOG10E
- Next Page min()
- Go Back to the Previous Level JavaScript Math Reference Manual
Definition and usage
max()
The method returns the number with the highest value.
Tip:min()
The method returns the number with the minimum value.
Instance
Example 1
The largest return value:
Math.max(5, 10);
Example 2
The highest return value:
var a = Math.max(5, 10); var b = Math.max(0, 150, 30, 20, 38); var c = Math.max(-5, 10); var d = Math.max(-5, -10); var e = Math.max(1.5, 2.5);
Syntax
Math.max(n1, n2, n3, ... , nX)
Parameter value
Parameter | Description |
---|---|
n1, n2, n3, ... , nX | Optional. One or more numbers to be compared. |
Technical details
Return value: |
A number, representing the maximum value in the parameter.
|
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
max() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Math
- Previous Page LOG10E
- Next Page min()
- Go Back to the Previous Level JavaScript Math Reference Manual