JavaScript exp()Method

Math 对象参考手册JavaScript Math Object

Example

Returns E to thexpower of x, where x is 1:

Math.exp(1);

Output:

2.718281828459045

Try it Yourself »

Definition and Usage

The exp() method returns the value of e raised to the power of x.E is the base of natural logarithms(approximate value 2.7183).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the exp() method


Syntax

Math.exp(x)

Parameter Values

Parameter Description
x Required. A number

Return Value

Type Description
Number Returns e to the power of x. e represents the base of natural logarithms, and its value is approximately 2.71828.

Technical Details

JavaScript Version: 1.0


More Examples

Example

In the following example, we will apply exp() to different numbers:

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

a,b, andcOutput:

0.36787944117144233
148.4131591025766
22026.465794806718

Try it Yourself »


Math 对象参考手册JavaScript Math Object

Other Extensions