max (JavaScript)

Gets the greater of two numbers.

Defined in

Math (JavaScript)

Syntax

max(v1:double, v2:double) : double
Parameter Description
v1 A number.
v2 A number.
Return value Description
double The value of the greater number, or the value of either if they are equal.

Examples

This onblur event is for a field bound to sessionScope.n and forces it to have a minimum value of sessionScope.max.
sessionScope.n = Math.max(sessionScope.n, sessionScope.max)