Math.exp()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE3+, Opera3+ Syntax

							math.exp(num)

Description

The exp() method of the Math object is used to calculate an exponent where the base is Euler's constant (the base of the natural logarithms).

Example

Listing 6.159 shows how the exp() method is used to calculate an exponential value using the number input by the user.

Listing 6.159 Example of the exp() Method
 <html> <body> <script language="JavaScript"> <!–– Hide // function doMath calculates exponential value function doMath(){ var inputNum=document.form1.input.value; var result = Math.exp(inputNum); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> Enter First Number: <input type="text" ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.