Math exp() Method - Javascript Math

Javascript examples for Math:exp

Description

The exp() method returns the value of E^x, where E is Euler's number (approximately 2.7183) and x is the number passed to it.

Parameter Values

Parameter Description
x Required. A number

Return Value:

A Number, representing E^x

The following code shows how to return E^x

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  w  w  w .java 2s.c om
    var a = Math.exp(-1);
    var b = Math.exp(5);
    var c = Math.exp(10);

    var x = a + "<br>" + b + "<br>" + c;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials