TypeScript | toExponential() Method
The toExponential() method in TypeScript is used to convert a number to its exponential form. This method returns a string representing the given number object in exponential notation according to the given parameter.
number.toExponential( [fractionDigits] )
Parameters: This method accepts a single parameter as mentioned above and described below:
- fractionDigits: It is an integer value that specifies the number of digits after the decimal point. It is an optional parameter.
Return Value: The toExponential() method in TypeScript returns a string representing the number object in exponential notation with one digit before the decimal point.
Below examples illustrate the working of toExponential() method in TypeScript: