JavaScript Number.toExponential() 方法


JavaScript Number.toExponential() 方法

<html>
   <head>
      <title>JavaScript Method toExponential()</title>
   </head>

   <body>
      <script>
         var num=77.1234;
         var val = num.toExponential();
         document.write("num.toExponential() is : " + val );
         document.write("<br />");

         val = num.toExponential(4);
         document.write("num.toExponential(4) is : " + val );
         document.write("<br />");

         val = num.toExponential(2);
         document.write("num.toExponential(2) is : " + val);
         document.write("<br />");

         val = 77.1234.toExponential();
         document.write("77.1234.toExponential()is : " + val );
         document.write("<br />");

         val = 77.1234.toExponential();
         document.write("77 .toExponential() is : " + val);
      </script>
   </body>
</html>