C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Number toExponential methodThe JavaScript number toExponential() method converts the given number into an exponential notation and returns it in the form of string. Syntax
The toExponential() method is represented by the following syntax: Number. toExponential(num) Parameter
num - It is optional. It represents an integer that specify the digits to be placed after decimal point. Return
A string that represents exponential notation of the given number. JavaScript Number toExponential method exampleHere, we will understand toExponential() method through various examples. Example 1Let's see a simple example of toExponential() method. <script> var a=989721; document.writeln(a.toExponential()); </script> Output: 9.89721e+5 Example 2In this example, we will pass an integer that specify the digits to be placed after decimal point. <script> var a=989721; document.writeln(a.toExponential(2)+"<br>"); document.writeln(a.toExponential(4)+"<br>"); document.writeln(a.toExponential(6)); </script> Output: 9.90e+5 9.8972e+5 9.897210e+5
Next TopicJavaScript Number
|