How To Use Number Object toExponential In JavaScript
In this article I am going to explain about Number Object toExponential Method In JavaScript.
Use toExponential method in JavaScript
The toExponential() method converts a number into an exponential notation in JavaScript.
All browsers support number object toExponential method.
Syntax
Example
<!DOCTYPE html>
<html>
<body style ="background-color:Red">
<p id="demo">Display the exponential notation of a specified number.</p>
<button onclick="myFunction()">Click here</button>
<script type="text/javascript">
function myFunction()
{
var num = 5.56789;
var x = document.getElementById("demo");
x.innerHTML = num.toExponential();
}
</script>
</body>
</html>
|
Output1
Output2
Further Readings
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here