Javascript examples for Math:exp
The exp() method returns the value of E^x, where E is Euler's number (approximately 2.7183) and x is the number passed to it.
Parameter | Description |
---|---|
x | Required. A number |
A Number, representing E^x
The following code shows how to return E^x
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w .java 2s.c om var a = Math.exp(-1); var b = Math.exp(5); var c = Math.exp(10); var x = a + "<br>" + b + "<br>" + c; document.getElementById("demo").innerHTML = x; } </script> </body> </html>