源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <script> var x; document.write("<p>仅显示17位: "); x=12345678901234567890; document.write(x + "</p>"); document.write("<p>0.2 + 0.1 = "); x=0.2+0.1; document.write(x + "</p>"); document.write("<p>可以通过乘以10或除以10来计算: "); x=(0.2*10+0.1*10)/10; document.write(x +"</p>"); </script> </body> </html>
运行结果