Pages

Thursday, February 23, 2012

Math.Round() in java script

Syntax:
Math.round(x)


Example

<script type="text/javascript">

document.write(Math.round(0.75) + "<br />");
document.write(Math.round(0.50) + "<br />");
document.write(Math.round(0.25) + "<br />");
document.write(Math.round(-4.30) + "<br />");
document.write(Math.round(-4.88));

</script>


OUTPUT:


1
1
0
-4
-5

No comments:

Post a Comment