Number.prototype.toExponential
Returns a string representing the Number object in exponential notation
Syntax
number.toExponential(fractionDigits?)Parameters
| Parameter | Type | Description |
|---|---|---|
| fractionDigits | number | Number of digits after the decimal point (0-100) |
Return Value
A string representing the number in exponential notation
Examples
const num = 123456;
console.log(num.toExponential()); // '1.23456e+5'
console.log(num.toExponential(2)); // '1.23e+5'console.log((0.00123).toExponential()); // '1.23e-3'
console.log((77.1234).toExponential(4)); // '7.7123e+1'const avogadro = 6.022e23;
console.log(avogadro.toExponential(3)); // '6.022e+23'Understanding Number.prototype.toExponential
The Number.prototype.toExponential method in JavaScript returns a string representing the Number object in exponential notation. It belongs to the Number object and is one of the most widely used methods for working with number values in modern JavaScript and TypeScript applications.
The method signature is number.toExponential(fractionDigits?). It accepts 1 parameter: fractionDigits. When called, it returns a string representing the number in exponential notation. Understanding when and how to use toExponential() helps you write more expressive, readable code.
Common use cases for Number.prototype.toExponential include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like number-tofixed, number-toprecision, number-tostring, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Number.prototype.toExponential is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Number.prototype.toFixedFormats a number using fixed-point notation with the specified number of decimal places
Number.prototype.toPrecisionReturns a string representing the Number object to the specified precision
Number.prototype.toStringReturns a string representing the specified Number object in the specified radix (base)
More Number Methods
Other methods in the Number object
Related Tools
More Number Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.