JavaScript Math Object
The Javascript Math object is used for performing mathematical calculations using properties and functions like: max, min, round, random, sin, cos, sqrt, log, ceil, abs, e, pi.
JavaScript Math Object
Example Max()
<script type="text/javascript">
<!--
var a = document.getElementById.innerHTML=Math.max(3,7);
document.write(a);
//-->
</script>
|
Result:
Example Min()
<script type="text/javascript">
<!--
var a = document.getElementById.innerHTML=Math.min(3,7);
document.write(a);
//-->
</script>
|
Result:
Example Round()
<script type="text/javascript">
<!--
var a = document.getElementById.innerHTML=Math.round(3.7);
document.write(a);
//-->
</script>
|
Result: