Create Number object : Number Constructors « Number Data Type « JavaScript Tutorial






<html>
<head>
<title>Demonstrating the toPrecision() method</title>
<script type="text/javascript" language="javascript">
<!-- //
function DisplayPrecision(){
    number = new Number(1200000000003);
    for (var i=1; i<8; i++){
        document.write(number.toPrecision(i));
    }
}
// -->
</script>
</head>
<body onload="DisplayPrecision()">
<P>This listing demonstrates the use of the toPrecision() method.</p><br />
</body>
</html>








5.6.Number Constructors
5.6.1.The Number Class
5.6.2.toFixed() method
5.6.3.Create Number object