Standard built-ins

Math.max()

Try the free JavaScript compiler

Returns the greatest converted Number; no arguments yields -Infinity. NaN propagates, and +0 wins a zero tie.

Formal Syntax & Structure

javascript syntaxjavascript
Math.max(...values)

Parameters & Attributes

NameTypeDescription
valuesnumber[]Individual numeric arguments (coerced to Number).

Return Value

number

Calculated Number.

Working Example

Example Snippetjavascript
console.log(Math.max(5,2),Math.max());
JavaScript Reference