JavaScript Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Java-Script Tutorial
Introduction Introduction
Variables Variables
Operators Operators
Statements Statements
Loops Loops
Functions Functions
Objects Objects
Arrays Arrays
Cookies JS Cookies
Browser Objects Browser Objects
Form DOM Form DOM
Style Objects DOM Style Objects
Forums Ask Your Doubts
Scraps More about Javascript
Feedback Feedback
 




Math.min() Method - Math Functions


Tutorials Javascript

Topic

Math.min() method of Math Functions in Javascript.
How to get the Lowest number in javascript?



Explanation

Object: Math

Method: Math.min()

Description: To get the minimal or lowest number from the numbers listed. The below example will get the minimal or the lowest number from the entered numbers using math functions.

Example:
<html>
<script type="text/javascript">
function minnum()
{
var one=document.frm.num1.value;
var two=document.frm.num2.value;
alert('Minimum value is::'+ Math.min(one,two));
}
</script>
<form name=frm>
First Number :<input type="text" name="num1" size=10>
<br><br>
Second Number :<input type="text" name="num2" size=10>
<br>
<input type="button" value="Show Min number" onClick="minnum()">
</form>
</html>
Result:
First Number :

Second Number :


In the above example,
  • Two numbers are got a input using a form.
  • Math.min() method is used to get the lowest number out of the two.






  • A Note
    Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

    Other Links

    web hosting