92
JavaScript Math max() method
The JavaScript math max() method compares the given numbers and returns the maximum value.
Syntax
The max() method is represented by the following syntax:
Parameter
num1,num2,….,numN – Numbers to be compared..
Return
A maximum value of the given numbers.
JavaScript Math max() method example
Here, we will understand max() method through various examples.
Example 1
Let’s see a simple example to print the maximum value of the given numbers.
Output:
34 -10
Example 2
Let’s see an example to print the maximum value of the given array.
Output:
15
Next TopicJavaScript Math