Tutorialspoint.dev

Math.exp( ) In JavaScript

The Math.exp() function in JavaScript is used to return ex, where x is the argument, and e is Euler’s number, which is the base of the natural logarithms.
exp() is a static method of Math, therefore, it is always used as Math.exp(), rather than as a method of a Math object created.

Syntax:

Math.exp(value)

Parameters Used:
Value:A number whose ex you want to find.

Return Value:
The Math.exp() function returns ex where e is Euler’s number and x is the argument.

Examples:



  1. When zero is passed as a parameter.
    <script type="text/javascript">
       document.write("Output : " + Math.exp(0));
    </script>

    Output:

    Output : 1
  2. When “-1” is passed as a parameter.
    <script type="text/javascript">
       document.write("Output : " + Math.exp(-1));
    </script>

    Output:

    Output : 0.36787944117144233 
  3. When “1” is passed as a parameter.
    <script type="text/javascript">
       document.write("Output : " + Math.exp(1));
    </script>

    Output:

    Output :  2.718281828459045 


This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter