Math.exp()
Returns e raised to the power of a number.
Syntax
Math.exp(x) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | number | Yes | The exponent to raise e to. |
Returns
number — e^x.
Examples
console.log(Math.exp(0));
Output
1
console.log(Math.exp(1) === Math.E);
Output
true
Notes
The inverse of `Math.log`. Large arguments overflow to Infinity. Use
`Math.expm1` for accurate results when x is near zero.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |
| node | 0.10 |