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

This JavaScript tutorial explains how to use the math function called expm1() with syntax and examples.


In JavaScript, expm1() is a function that is used to return e raised to the energy of wide variety minus 1 (which is enumber – 1). Because the expm1() function is a static characteristic of the Math object, it have to be invoked via the placeholder object called Math.


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


Parameters or Arguments

number The variety used as the exponent in enumber – 1 the place e is the base of herbal logarithms.


The expm1() feature returns enumber – 1 where e is the base of natural logarithms and number is the exponent used in the calculation. The mathematical constant e has an approximate cost of 2.71828.


Math is a placeholder object that consists of mathematical features and constants of which expm1() is one of these functions.


Let’s take a seem at an example of how to use the expm1() feature in JavaScript.

For example:


In this example, we have invoked the expm1() characteristic the usage of the Math class.

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

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


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

The 2d output to the console log again 1.718281828459045 which is the calculation of e1 – 1.

The 0.33 output to the console log back -0.8646647167633873 which is the calculation of e-2 – 1.