JavaScript Math.min() | Find Smallest Number

The JavaScript Math.min() method returns the smallest number from given list of numbers. For example:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>

   <p id="xyz"></p>
 
   <script>
      let smallNum = Math.min(12, 43, 54, 10, 4);
      document.getElementById("xyz").innerHTML = smallNum;
   </script>
   
</body>
</html>
Output

JavaScript Math.min() Syntax

The syntax of Math.min() method in JavaScript is:

Math.min(n1, n2, n3, ..., nN)

n1, n2, n3 and so on, are all refers to numbers. All parameters are optional.

The Math.min() method returns a number with lowest value. Also if no arguments are passed or provided to Math.min() method, it will return Infinity. Otherwise will return NaN if one or multiple arguments are not a number.

JavaScript Online Test


« Previous Tutorial Next Tutorial »



Like/Share Us on Facebook 😋