Below is the example of the Math exp() Method.
- Example:
<scripttype="text/javascript">document.write("When zero is passed as a parameter: "+ Math.exp(0));</script>chevron_rightfilter_none - Output:
When zero is passed as a parameter: 1
The Math.exp() method is used to return ex, where x is the argument, and e is Euler’s number, which is the base of the natural logarithms. The exp() is a static method of Math, therefore, it is always used as Math.exp(), rather than as a method of a Math object created.
Syntax:
Math.exp(value)
Parameters Used: This function accepts a single parameter as mentioned above and described below:
- value is a number whose ex you want to find.
Returns: The Math.exp() method returns ex where e is Euler’s number and x is the argument.
More codes for the above method are as follows:
Program 1: When “-1” is passed as a parameter.
<script type="text/javascript"> document.write("Result : " + Math.exp(-1)); </script> |
Output:
Result : 0.36787944117144233
Program 2: When “1” is passed as a parameter.
<script type="text/javascript"> document.write("Result : " + Math.exp(1)); </script> |
Output:
Result : 2.718281828459045
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- JavaScript Math cos( ) Method
- JavaScript Math tan( ) Method
- JavaScript Math min( ) Method
- JavaScript Math abs( ) Method
- JavaScript Math log( ) Method
- JavaScript Math pow( ) Method
- JavaScript Math max() Method
- JavaScript Math sin( ) Method
- JavaScript Math atanh( ) Method
- JavaScript Math trunc( ) Method
- JavaScript Math tanh() Method
- JavaScript Math acos( ) Method
- JavaScript Math asin( ) Method
- JavaScript Math atan2( ) Method
- JavaScript Math asinh() Method
- JavaScript Math ceil( ) Method
- JavaScript Math cosh() Method
- JavaScript Math acosh() Method
- JavaScript Math atan( ) Method
- JavaScript Math round( ) Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


