Home »
JavaScript
Math.exp() Method with Example in JavaScript
JavaScript | Math.exp() Method: Here, we are going to learn about the exp() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on December 06, 2019
JavaScript | Math.exp() Method
Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.exp() method, we will learn about the exp() method and its working with examples.
Math.exp() is a function in math library of JavaScript that is used to find the value of ex of the number x, where x is the given value.
Syntax
Math.exp(x);
Parameters
- x – It represents the value whose ex value to be found.
Return Value
The return type of this method is number, it returns the ex of the given x.
Example 1: Passing numeric values to the function
console.log(Math.exp(1));
console.log(Math.exp(0));
console.log(Math.exp(-1));
console.log(Math.exp(-45));
Output
2.718281828459045
1
0.36787944117144233
2.8625185805493937e-20
Example 2: Passing non-numeric values to the function
console.log(Math.exp("Hello"));
Output
NaN
JavaScript Math Object Methods »