Standard built-ins
Number.prototype.toExponential()
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
| Name | Type | Description |
|---|---|---|
| fractionDigits | number | Optional digits after the coefficient decimal point. |
Return Value
string
Formatted Number.
Working Example
Example Snippetjavascript
console.log((1234).toExponential(2));