Skip to content

JavaScript exponential notation | Example code

  • by

The toExponential() method in JavaScript is used to convert a number to its exponential notation form. It returns a string representing the Number object in exponential notation.

number.toExponential(value)

JavaScript exponential notation example

Simple HTML example code converts a number into an exponential notation.

<!DOCTYPE html>
<html>
<head>

  <script>
    let num = 5.56789;
    let n1 = num.toExponential();
    console.log(n1) 
    let n2 = num.toExponential(3); 
    console.log(n2) 

  </script>

</head>
</html>

Output:

JavaScript exponential notation

Do comment if you have any doubts or suggestions on this JS exponential notation topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *