Latest web development tutorials

JavaScript exp () method

Math Object Reference JavaScript Math Object

Examples

Returns E power of x value, x is 1:

Math.exp(1);

Output:

2.718281828459045

try it"

Definition and Usage

exp () method returns the value of e x times the power. E is a natural base (approximate value 2.7183).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support exp () method


grammar

Math.exp( x )

Parameter Value

参数 描述
x Required. A number

return value

类型 描述
Number 返回 e 的 x 次幂。e 代表自然对数的底数,其值近似为 2.71828。

technical details

JavaScript version: 1.0


More examples

Examples

In the following example, we'll exp () applied to the different values:

var a=Math.exp(-1);
var b=Math.exp(5);
var c=Math.exp(10);

a, b, and c output:

0.36787944117144233
148.4131591025766
22026.465794806718

try it"


Math Object Reference JavaScript Math Object