Javascript Reference - JavaScript exp() Method








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

Browser Support

exp() Yes Yes Yes Yes Yes

Syntax

Math.exp(x);

Parameter Values

x - A number.

Return Value

A Number, representing Ex.





Example


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from   w  w w. j a  va  2  s. co m-->
    document.getElementById("demo").innerHTML = Math.exp(1);
}
</script>
</body>
</html>

The code above is rendered as follows: