专注前端素材!
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>素材8网教程(study.sucai8.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>
运行结果