Latest

recent

JavaScript exp() Method

Definition and Usage

The exp() method returns the value of Ex, where E is Euler's constant (approximately 2.7183) and x is the number passed to it.

Syntax

Math.exp(x)

Parameter Description
x Required. A number


Tips and Notes

Tip: E is the Euler's constant, which is the base of natural logarithms (approximately 2.7183).

Example

 In the following example we will use the exp() method on different numbers:

<script type="text/javascript">
document.write(Math.exp(1) + "<br />");
document.write(Math.exp(-1) + "<br />");
document.write(Math.exp(5) + "<br />");
document.write(Math.exp(10) + "<br />");
</script>

The output of the code above will be:

2.718281828459045
0.36787944117144233
148.4131591025766
22026.465794806718
JavaScript exp() Method Reviewed by 1000sourcecodes on 02:52 Rating: 5
Powered by Blogger.