Convert a number into an exponential notation:
let num = 5.56789;
let n = num.toExponential();
Try it Yourself »
The toExponential() method converts a number into an exponential notation.
number.toExponential(
x)
Parameter | Description |
---|---|
x | Optional. An integer between 0 and 20 representing the number of digits in the notation after the decimal point. If omitted, it is set to as many digits as necessary to represent the value |
A String, representing the number as an exponential notation. |
toExponential()
is an ECMAScript3 (ES3) feature.
ES3 (JavaScript 1999) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!