Rounding a number to an integer : round : Math JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Math » round »

 

Rounding a number to an integer

















<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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Math
» round