JavaScript - Math.exp() Method
The JavaScript Math.exp() method returns e raised to the power of specified number, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718281828459045.
Syntax
Math.exp(x)
Parameters
x |
Specify the exponent of e. |
Return Value
Returns e raised to the power of specified number.
Example:
In the example below, Math.exp() method is used to calculate e raised to the power of specified number.
var txt; txt = "Math.exp(2) = " + Math.exp(2) + "<br>"; txt = txt + "Math.exp(-2) = " + Math.exp(-2) + "<br>"; txt = txt + "Math.exp(1.5) = " + Math.exp(1.5) + "<br>"; txt = txt + "Math.exp(-1.5) = " + Math.exp(-1.5) + "<br>";
The output (value of txt) after running above script will be:
Math.exp(2) = 7.38905609893065 Math.exp(-2) = 0.1353352832366127 Math.exp(1.5) = 4.4816890703380645 Math.exp(-1.5) = 0.22313016014842982
❮ JavaScript - Math Object