JavaScript Tutorial/Math/E
Math.E
The E property gets the value of Euler"s constant. This is approximately 2.718.
<html>
<body>
<script language="JavaScript">
<!--
function doMath(){
var result = Math.E;
document.form1.answer.value = result;
}
-->
</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>
The value of Euler"s constant: Math.E
<html>
<head>
<title>The Properties of the Math object</title>
<script type="text/javascript" language="javascript">
<!-- //
function DisplayMath(){
document.write("<br/><P>The value of Euler"s constant <i>E</i> is: " + Math.E + "</p>");
}
// -->
</script>
</head>
<body onload="DisplayMath()">
</body>
</html>