X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript toExponential() Method

JavaScript Number Reference JavaScript Number Reference

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 »


Definition and Usage

The toExponential() method converts a number into an exponential notation.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The toExponential() method is supported in all major browsers.


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

Return Value

Type Description
String The number as an exponential notation

Technical Details

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 »


JavaScript Number Reference JavaScript Number Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook