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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA