Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
karthikeya Boyini

The max() function of the Math object accepts multiple numbers and returns the largest numbers among them.

  • If you pass single number to this function it will return the same
  • And, if you do not pass any arguments to it will return infinity.

Syntax

Its Syntax is as follows

Math.max(48, 148, 3654);

Example

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         var result = Math.max(48, 148, 3654);
         document.write("Maximum of the given numbers: "+result); 
      </script>
   </body>
</html>

Output

Maximum of the given numbers: 3654

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.