Easy Tutorial
❮ Coll Tr Cells Prop Video Readystate ❯

JavaScript toExponential() Method

JavaScript Number Object

Example

Convert the value of an object to exponential notation:

n Output result:


Definition and Usage

The toExponential() method converts the value of an object to exponential notation.


Browser Support

All major browsers support the toExponential() method.


Syntax

Parameter Values

Parameter Description
x Optional. Specifies the number of digits after the decimal point in exponential notation, ranging from 0 to 20, inclusive. Some implementations may support a wider range of values. If omitted, it uses as many digits as necessary.

Return Value

Type Description
String Returns a string representation of the Number object in exponential notation, with one digit before the decimal point and num digits after the decimal point. The fractional part of the number is rounded, and padded with zeros if necessary to meet the specified length.

Technical Details

| JavaScript Version: | 1.5 | | --- | --- |


More Examples

Example

In this example, we will convert a number to exponential notation:

The above example output result:


JavaScript Number Object

❮ Coll Tr Cells Prop Video Readystate ❯