JavaScript toExponential() Method
Example
Convert a number into an exponential notation:
var num = 5.56789;
var n = num.toExponential();
The result of n will be:
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The toExponential() method converts a number into an exponential notation.
Browser Support
Method | |||||
---|---|---|---|---|---|
toExponential() | Yes | Yes | Yes | Yes | Yes |
Syntax
number.toExponential(x)
Parameter Values
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 |
Technical Details
Return Value: | A String, representing the number as an exponential notation |
---|---|
JavaScript Version: | 1.5 |

More Examples
Example
Convert a number into an exponential notation:
var num = 5.56789;
var n = num.toExponential(3);
The result of n will be:
Try it Yourself »
