JavaScript Number.toExponential() Method

You are Here:

JavaScript Number.toExponential() Method

The Number.toExponential() method returns a string representing the number as an exponential notation.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> var numObj = 12.98765; var result = numObj.toExponential(2); document.write(result); </script> </body> </html>

Syntax

Number.toExponential(fractionDigits)

Parameter Values

ValueTypeExplanation
fractionDigitsoptionalAn integer specifying the number of digits after the decimal point.
A range is between 0 and 20.
If omitted, it is set to as many digits as necessary to represent the value.

Return Value

ValueExplanation
StringA string representing the number as an exponential notation.

More Examples

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> var numObj = 12.98765; var result1 = numObj.toExponential(2); var result2 = numObj.toExponential(); document.write(result1 +"<br>"); document.write(result2 +"<br>"); </script> </body> </html>

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author