Mega Code Archive

 
Categories / JavaScript Tutorial / Number Data Type
 

Demonstrating the toPrecision() method

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