Home >>JavaScript Math Reference >JavaScript exp() Method

JavaScript exp() Method

JavaScript exp() Method

The JavaScript math exp() method return ex. Here, x is the argument, and e is the Euler’s constant. e is the base of natural algorithm. It is always used at Math.exp() because it is static method of math.

Syntax:
Math.exp(x)

Parameter Values

Parameter Description
X It Required a Number.

Browser Support

Method Chrome Edge Firefox Safari Opera
exp() Yes Yes Yes Yes Yes
Here is an example of JavaScript exp() method
<html>
<body>
<button onclick="myexp()">Click me</button>
<p id="exp"></p>
<script>
function myexp() {
  document.getElementById("exp").innerHTML = Math.exp(1);
}
</script>
</body>
</html>
Output:

Example 2:
<html>
<body>
<script>
document.writeln(Math.exp(1)+"<br>");
document.writeln(Math.exp(3)+"<br>");
document.writeln(Math.exp(-3));
</script>
</body>
</html>
Output: