Math.max

Returns the larger of two numbers.

Method of Math
Static

Syntax

max( x, y )

Parameters

Parameter Description
x, y Numbers.

Description

Because max is a static method of Math, you always use it as Math.max(), rather than as a method of a Math object you created.

Examples

The following function evaluates the variables x and y:

If you pass getMax the values 10 and 20, it returns 20; if you pass it the values -10 and -20, it returns -10.

See also

Math.min

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.