运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,暗色/亮色
前往 Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Number Methods</h2> <p>The toExponential() method returns a string, with the number rounded and written using exponential notation.</p> <p>An optional parameter defines the number of digits behind the decimal point.</p> <p id="demo"></p> <script> let x = 9.656; document.getElementById("demo").innerHTML = x.toExponential() + "<br>" + x.toExponential(2) + "<br>" + x.toExponential(4) + "<br>" + x.toExponential(6); </script> </body> </html>