X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML 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 »

More "Try it Yourself" examples below.


Definition and Usage

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


Browser Support

Method
toExponential() Yes Yes Yes Yes Yes


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

Technical Details

Return Value: A String, representing the number as an exponential notation
JavaScript Version: 1.5


Examples

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 HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook