Below is the example of the Math exp() Method.
document.write("When zero is passed as a parameter: "
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.
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.
Result : 0.36787944117144233
Program 2: When “1” is passed as a parameter.
Result : 2.718281828459045
- Google Chrome
- Internet Explorer