JavaScript Number toExponential()

The syntax of the toExponential() method is:

num.toExponential(fractionDigits)

Here, num is a number.


Number toExponential() Parameters

The toExponential() method takes in:

  • fractionDigits (Optional) - An integer specifying the number of digits after the decimal point. By default, it is as many digits as necessary to specify the number.

Return value from Number toExponential()

  • Returns a string representing the given Number object in exponential notation, rounded to fractionDigits digits after the decimal point.

Example: Using Number.toExponential()

let num = 695.8457;

let exp_num = num.toExponential();
console.log(exp_num); // 6.958457e+2

let exp_num1 = num.toExponential(2);
console.log(exp_num1); // 6.96e+2

Output

6.958457e+2
6.96e+2

Recommended Readings:

Did you find this article helpful?

Your builder path starts here. Builders don't just know how to code, they create solutions that matter.

Escape tutorial hell and ship real projects.

Try Programiz PRO
  • Real-World Projects
  • On-Demand Learning
  • AI Mentor
  • Builder Community