Math.max(inp1, inp2, inp3) : Math « Development « JavaScript DHTML






Math.max(inp1, inp2, inp3)

  

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
inp1 = 1;
inp2 = 2;
inp3 = 3;
alert("The largest number entered was " + Math.max(inp1, inp2, inp3));
alert("The smallest number entered was " + Math.min(inp1, inp2, inp3));
</script>
</head>
<body>
</body>
</html>

   
    
  








Related examples in the same category

1.Demo all math methods
2. Counting Rabbits (Calculating the Fibonacci Series Using a Recursive Function)
3.Math Round: round a number to the nearest whole number
4.Max number: get max number from two inputs
5.Min number: get the min number from two inputs
6.Using the Math Object
7.Math.min(inp1, inp2, inp3)
8.Math.random()
9.Math.round(rndNum)
10.Parenthesis for math statement
11.Using the const Keyword (Firefox only)
12.Calculate with Math.PI
13.Math Object Property Summaries