Math.exp()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

概述

Math.exp() 函数返回 e^xx 表示参数,e欧拉常数(Euler's constant),自然对数的底数。

语法

js
Math.exp(x)

参数

x

一个数值

描述

由于 expMath 的静态方法,所以应该像这样使用:Math.exp(),而不是作为你创建的 Math 实例的方法。

示例

示例:使用 Math.exp

js
Math.exp(-1); // 0.36787944117144233
Math.exp(0); // 1
Math.exp(1); // 2.718281828459045

规范

Specification
ECMAScript® 2025 Language Specification
# sec-math.exp

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
exp

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见