LOG2E (JavaScript)

Value of the logarithm of e to the base 2.

Defined in

Math (JavaScript)

Syntax

Math.LOG2E

Usage

LOG2E is a constant.

The value of the logarithm of e to the base 2 is approximately 1.4426950408889634.

To get the logarithm to the base 2 of any number n, multiplyMath.log(n) by this constant.

Examples

This button onclick event gets the logarithm of a number to the base 2.
sessionScope.log2 = Math.log(sessionScope.n) * Math.LOG2E