JavaScript Number toExponential()

Example 1

Convert a number into an exponential notation:

let num = 5.56789;
let n = num.toExponential();
Try it Yourself »

Description

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

Example 2

let num = 5.56789;
let n = num.toExponential(3);
Try it Yourself »


Syntax

number.toExponential(x)

Parameters

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

A String, representing the number as an exponential notation.

Browser Support

toExponential() is an ECMAScript3 (ES3) feature.

ES3 (JavaScript 1999) is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.