Edit Code in left box and click Show Results button to see the result. | Home
<html> <!-- Mirrored from www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_62 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 13:58:57 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack --> <head> <title>JavaScript toFixed() Method</title> </head> <body> <script type="text/javascript"> var num=177.1234; document.write("num.toFixed() is : " + num.toFixed()); document.write("<br />"); document.write("num.toFixed(6) is : " + num.toFixed(6)); document.write("<br />"); document.write("num.toFixed(1) is : " + num.toFixed(1)); document.write("<br />"); document.write("(1.23e+20).toFixed(2) is:" + (1.23e+20).toFixed(2)); document.write("<br />"); document.write("(1.23e-10).toFixed(2) is : " + (1.23e-10).toFixed(2)); </script> </body> <!-- Mirrored from www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_62 by HTTrack Website Copier/3.x [XR&CO'2010], Thu, 01 Sep 2011 13:58:57 GMT --> <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack --> </html> |