Home JavaScript Math Methods exp() JavaScript Math.exp() Method Definition Math.exp(x) returns e to the power of x . Here e is Euler's number, about 2.71828. It is the same as Math.E ** x.
Math is built into JavaScript. Call the method directly. It is not a constructor, so never write new Math().
Syntax Call Math.exp() like this. Start with this line.
Call What it does Math.exp(x)Returns e raised to the power x.
Built into JavaScript. Call Math.exp() on the Math object — no import required.
Library declarations interface Math {
exp(x: number): number;
} Parameters Parameter Description x Required. A number. Other values are converted to a number first.
Return Value Return Value Description number e raised to the power x. Returns NaN if x cannot be turned into a number.
JavaScript Examples 1. Basic use 2. Continuous growth 3. Opposite of log() and limits Example 1 — Basic Use Pass the power. You get e raised to it.
console.log(Math.exp(0)); // 1
console.log(Math.exp(1)); // 2.718281828459045
console.log(Math.exp(2)); // 7.38905609893065
console.log(Math.exp(-1)); // 0.36787944117144233 1
2.718281828459045
7.38905609893065
0.36787944117144233 How It Works Power 0. Anything to the power 0 is 1.Power 1. Math.exp(1) is e itself, about 2.718.Negative power. Math.exp(-1) is 1 / e, about 0.368.Example 2 — Continuous Compound Growth With continuous growth, money grows by P * e^(rate * time).
var principal = 1000;
var rate = 0.05; // 5% per year
var years = 3;
var total = principal * Math.exp(rate * years);
console.log(total.toFixed(2)); // 1161.83 How It Works Set values. Start with 1000, a 5% rate, and 3 years.Multiply rate and time. rate * years is 0.15.Apply exp. Math.exp(0.15) is about 1.1618, so the total is about 1161.83.Example 3 — Opposite of log() and Limits exp and log undo each other. Huge and tiny inputs hit the limits of a number.
console.log(Math.log(Math.exp(3))); // 3
console.log(Math.exp(Math.log(10)).toFixed(4)); // 10.0000
console.log(Math.exp(710)); // Infinity
console.log(Math.exp(-1000)); // 0 How It Works Undo with log. Math.log(Math.exp(3)) gives back 3.Undo with exp. Math.exp(Math.log(10)) gives 10 (round to hide tiny noise).Too big. Math.exp(710) is Infinity.Too small. Math.exp(-1000) rounds down to 0.Compatibility
Browser & Runtime Support Math.exp() has been part of JavaScript since ES1 and is Baseline Widely available everywhere.
✓ Baseline · ES1
Math.exp() Supported in every browser and Node.js version. No polyfill is needed.
99% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support Math.exp Excellent
Bottom line: Use Math.exp() freely. It works in all browsers and runtimes.
Frequently Asked Questions What does Math.exp() do? Math.exp(x) returns e raised to the power x. Math.exp(0) is 1 and Math.exp(1) is about 2.718281828459045.
What is e in JavaScript? e is Euler's number, about 2.71828. You can read it from Math.E.
How is Math.exp() related to Math.log()? They are opposites. Math.log(Math.exp(x)) gives back x.
What does Math.exp(710) return? It returns Infinity, because the result is too big for a JavaScript number.
How is Math.exp() different from Math.pow()? Math.exp(x) always uses base e. Math.pow(base, x) lets you choose the base.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
11 people found this page helpful
Helpful Share Copy link Suggestion