JavaScript Number toExponential()
Example 1
Convert a number into an exponential notation:
let num = 5.56789;
let n = num.toExponential();
Try it Yourself »
Definition and Usage
The toExponential() method converts a number into an exponential notation.
Syntax
number.toExponential(x)
Parameters
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 |
Return Value
A String, representing the number as an exponential notation. |
Browser Support
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 |