Math.E

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

							math.E

Description

The E property of the Math object is used to get the value of Euler's constant. This is approximately 2.718.

Example

Listing 6.158 shows how the E property is used.

Listing 6.158 Example of the E Property
<html>
<body>

<script language="JavaScript">
<!–– Hide
// function to return Euler's constant
function doMath(){
    var result = Math.E;
    document.form1.answer.value = result;
}
// End Hide ––>
</script>

<form name=form1>
Click on the button to get Euler's constant.
<br><br>
Euler's constant is:
<input type="text" name="answer" size=20>
<input type="button" value="Calculate" onClick='doMath()'>
<br>
</form>

</body>
</html>
							
							
						

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.