Javatpoint Logo
Javatpoint Logo

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.

Test it Now

Output:

34
-10

Example 2

Let's see an example to print the maximum value of the given array.

Test it Now

Output:

15

Next TopicJavaScript Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA