Using Math exp() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math characteristic known as exp() with syntax and examples.


In JavaScript, exp() is a function that is used to return e raised to the energy of wide variety (which is enumber). Because the exp() feature is a static feature of the Math object, it should be invoked through the placeholder object referred to as Math.


In JavaScript, the syntax for the exp() feature is:


Parameters or Arguments

number The number used as the exponent in enumber where e is the base of natural logarithms.


The exp() function returns enumber the place e is the base of herbal logarithms and wide variety is the exponent used in the calculation. The mathematical regular e has an approximate price of 2.71828.


Math is a placeholder object that incorporates mathematical functions and constants of which exp() is one of these functions.


Let’s take a appear at an instance of how to use the exp() feature in JavaScript.

For example:


In this example, we have invoked the exp() function using the Math class.

We have written the output of the exp() characteristic to the net browser console log, for demonstration purposes, to show what the exp() characteristic returns.

The following will be output to the web browser console log:


In this example, the first output to the console log lower back 1 which is the calculation of e0.

The second output to the console log again 2.718281828459045 which is the calculation of e1.

The 1/3 output to the console log lower back 0.1353352832366127 which is the calculation of e-2.