Math.min() function JavaScript


The min() 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.min(48, 148, 3654);

Example

 Live Demo

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

Output

Maximum of the given numbers: 48

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 25-Jun-2020

98 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements