Math.LOG2E

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

							math.LOG2E

Description

The LOG2E property of the Math object calculates the base 2 logarithm of Euler's constant. The return value is approximately 1.442.

Example

Listing 6.165 shows how the LOG2E property is used.

Listing 6.165 Example of the log2E Property
<html>
<body>

<script language="JavaScript">
<!–– Hide
function doMath(){
    var result = Math.LN2E;
    document.form1.answer.value = result;
}
// End Hide ––>
</script>

<form name=form1>
The Base 2 logarithm of 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.