Rounding a number to an integer : round « Math « JavaScript Tutorial






<html>
<head>
<title>Rounding a number to an integer</title>
<script type="text/javascript" language="javascript">
<!-- //
function f(){
var num1 = 0.3;
var num2 = 0.1;
var result ;
result = num1 / num2;
document.write(Math.round(result));
}
// -->
</script>
</head>
<body onload="f()">

</body>
</html>








9.22.round
9.22.1.Math.round()
9.22.2.Rounding a number to an integer
9.22.3.Use Math.round to calculate area