JS Built-ins
NumbertoExponentialintermediate

toExponential() β€” basic usage

πŸ“– Usage Example
// Format number in exponential notation
(12345).toExponential(2)    // β†’ '1.23e+4'
(0.00123).toExponential(1)  // β†’ '1.2e-3'

Use toExponential() to express a number in scientific notation, useful when displaying very large or very small values.

Number.prototype.toExponential()

num.toExponential(fractionDigits?) returns a string representing the number in exponential notation.

(12345).toExponential()  // β†’ '1.2345e+4'
πŸ’‘ Hints (1)
  • β€’ `toExponential()` always returns a string in scientific notation.