![]() |
VOOZH | about |
The Math.max() method in JavaScript returns the largest value from a set of zero or more numbers. This method is a static method of the Math object, meaning it is always called Math.max() and not as a method of an instance of the Math object.
Math.max(value1, value2, ...);Here's a simple example of how the Math.max() method works:
Math.max() also works with negative numbers, returning the largest (least negative) value:
If no arguments are passed to Math.max(), the method will return -Infinity:
If any argument passed to Math.max() cannot be converted to a number, the method will return NaN:
We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.