JavaScript Tutorial/Math/min
Содержание
Finding the maximum and minimum number
<source lang="javascript">
<html> <head> <title>Finding the maximum and minimum number</title> <script type="text/javascript" language="javascript">
</script> </head> <body onload="SetFocus()"> <form name="SimpleForm">
Enter first number: | <input name="FirstInput" type="text"> |
Enter second number: | <input name="SecondInput" type="text"> |
Enter third number: | <input name="ThirdInput" type="text"> |
<button type="Button" onclick="FindMaxAndMin()"> Click to calculate</button> |
</form> </body> </html></source>
Find the minimum number by using the Math.min
<source lang="javascript">
<html> <head> <title>Finding the minimum number</title> <script type="text/javascript" language="javascript">
</script> </head> <body onload="f()"> </body> </html></source>
Math.min()
Syntax
<source lang="javascript">
math.min(num1, num2)</source>
Use Math.min the get the minimum value among three
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body> </body> </html></source>