JavaScript Math max() Method

The Math.max() method returns the number with the highest value

Definition and Usage

The Math.max() method returns the number with the highest value.

Syntax

Math.max(n1, n2,...)

Parameters

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

Return Value

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

Browser Support

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

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

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