Standard built-ins

Number.prototype.toExponential()

Try the free JavaScript compiler

Produces scientific notation. Fractional digits range 0–100; when omitted the coefficient uses enough digits to represent the Number. Out-of-range digit counts can throw RangeError. Result is text; binary representation influences rounding.

Formal Syntax & Structure

javascript syntaxjavascript
number.toExponential(fractionDigits?)

Parameters & Attributes

NameTypeDescription
fractionDigitsnumberOptional digits after the coefficient decimal point.

Return Value

string

Formatted Number.

Working Example

Example Snippetjavascript
console.log((1234).toExponential(2));
JavaScript Reference