Others



JavaScript Math.max()


The Math.max(x) method used to returns the number with the highest value in a list of arguments.

Syntax
Math.max(x)

Here, max() is a static method. Hence, we use it as Math.max().

Parameters
  • number1,number2,...,numberN - Numbers to be compared.
Return Value
  • Number - A highest value of the given arguments.
Example
console.log(Math.max(11,58));  //58
console.log(Math.max(5,7,9,6,8,25,84,68,12));  //84
console.log(Math.max(-10,-15,-85));  //-10
console.log(Math.max(10,-100,-250,85)); //85
console.log(Math.max(1.25,0.587,1.257)); //1.257
Try it Yourself

JavaScript Math Functions