toExponential Method

Top  Previous  Next

Converts a number into an exponential notation.

Syntax

number1.toExponential(number2)

Arguments

number1A number representing the number to be converted into exponential notation.
number2An integer between 0 and 21 representing the number of digits in the notation after the decimal point.

Return Value

The number as an exponential notation.

Remarks

If the argument is missing, it is set to 6 digits to represent the exponential value of the given number. if the argument is higher than 21 higher, nulls are added to create the actual decimal length.

Examples

var num= 5.85236;

var n=num.toExponential(4);   // Returns 5.8524e0