toExponential Method (Number)

toExponential Method (Number) (JavaScript)


Represents a number in exponential notation.

numObj. toExponential([fractionDigits])


Required. A Number object.


Optional. The number of digits after the decimal point. Must be in the range 0 – 20, inclusive.

Returns a string representation of a number in exponential notation. The string contains one digit before the decimal point, and may contain fractionDigits digits after it.

If fractionDigits is not supplied, the toExponential method returns as many digits necessary to uniquely specify the number.

var num = new Number(123);
var exp = num.toExponential();

num = new Number(123.456);
exp = num.toExponential(5);

// Output: 
// 1.23e+2
// 1.23456e+2


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Number Object (JavaScript)

© 2015 Microsoft